Commit fe47e60e authored by Brickner_cp's avatar Brickner_cp

Target Framework 4.0

No Code Analysis, 2 warnings
parent 03706aa6
...@@ -68,7 +68,6 @@ ...@@ -68,7 +68,6 @@
<ItemGroup> <ItemGroup>
<Compile Include="MoreIEnumerableTests.cs" /> <Compile Include="MoreIEnumerableTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TupleTests.cs" />
<Compile Include="UInt128Tests.cs" /> <Compile Include="UInt128Tests.cs" />
<Compile Include="UInt24Tests.cs" /> <Compile Include="UInt24Tests.cs" />
<Compile Include="UInt48Tests.cs" /> <Compile Include="UInt48Tests.cs" />
......
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PcapDotNet.Base.Test
{
/// <summary>
/// Summary description for TupleTests
/// </summary>
[TestClass]
public class TupleTests
{
public TupleTests()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext{ get; set;}
#region Additional test attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// Use TestCleanup to run code after each test has run
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#endregion
[TestMethod]
public void TupleTest()
{
Random random = new Random();
for (int i = 0; i != 100; ++i)
{
Tuple<int, double> expected = new Tuple<int, double>(random.Next(), random.NextDouble());
Tuple<int, double> equal = new Tuple<int, double>(expected.Value1, expected.Value2);
Tuple<int, double> different = new Tuple<int, double>(expected.Value1 + 1, expected.Value2);
Assert.AreEqual(expected, equal);
Assert.AreEqual(expected.GetHashCode(), equal.GetHashCode());
Assert.IsTrue(expected == equal);
Assert.IsFalse(expected != equal);
Assert.AreNotEqual(expected, different);
Assert.AreNotEqual(expected.GetHashCode(), different.GetHashCode());
Assert.IsFalse(expected == different);
Assert.IsTrue(expected != different);
}
}
}
/// <summary>
/// Summary description for DateTimeTests
/// </summary>
[TestClass]
public class DateTimeTests
{
public DateTimeTests()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext{ get; set;}
#region Additional test attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// Use TestCleanup to run code after each test has run
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#endregion
[TestMethod]
public void DateTimeToLocalTimeTest()
{
const long ticks = 633737178954260865;
Assert.AreEqual("Jerusalem Daylight Time", TimeZone.CurrentTimeZone.DaylightName);
Assert.AreEqual("Israel Standard Time", TimeZoneInfo.Local.Id);
DateTime dateTime = new DateTime(ticks, DateTimeKind.Local);
Assert.IsTrue(TimeZoneInfo.Local.IsInvalidTime(dateTime));
}
}
}
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PcapDotNet.Base</RootNamespace> <RootNamespace>PcapDotNet.Base</RootNamespace>
<AssemblyName>PcapDotNet.Base</AssemblyName> <AssemblyName>PcapDotNet.Base</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName> <SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
...@@ -46,7 +47,7 @@ ...@@ -46,7 +47,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<DocumentationFile>..\..\bin\Debug\PcapDotNet.Base.XML</DocumentationFile> <DocumentationFile>..\..\bin\Debug\PcapDotNet.Base.XML</DocumentationFile>
<CodeAnalysisRules> <CodeAnalysisRules>
</CodeAnalysisRules> </CodeAnalysisRules>
...@@ -60,7 +61,7 @@ ...@@ -60,7 +61,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<DocumentationFile>..\..\bin\Release\PcapDotNet.Base.XML</DocumentationFile> <DocumentationFile>..\..\bin\Release\PcapDotNet.Base.XML</DocumentationFile>
<CodeAnalysisRules> <CodeAnalysisRules>
</CodeAnalysisRules> </CodeAnalysisRules>
...@@ -89,7 +90,6 @@ ...@@ -89,7 +90,6 @@
<Compile Include="PropertyInfoExtensions.cs" /> <Compile Include="PropertyInfoExtensions.cs" />
<Compile Include="TimeSpanExtensions.cs" /> <Compile Include="TimeSpanExtensions.cs" />
<Compile Include="TypeExtensions.cs" /> <Compile Include="TypeExtensions.cs" />
<Compile Include="Tuple.cs" />
<Compile Include="UInt128.cs" /> <Compile Include="UInt128.cs" />
<Compile Include="UInt24.cs" /> <Compile Include="UInt24.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
......
using System;
namespace PcapDotNet.Base
{
/// <summary>
/// A tuple of two values.
/// </summary>
/// <typeparam name="TValue1">The type of the first value.</typeparam>
/// <typeparam name="TValue2">The type of the second value.</typeparam>
public struct Tuple<TValue1, TValue2> : IEquatable<Tuple<TValue1, TValue2>>
{
/// <summary>
/// Constructs a tuple from two values.
/// </summary>
/// <param name="value1">The first value.</param>
/// <param name="value2">The second value.</param>
public Tuple(TValue1 value1, TValue2 value2)
{
_value1 = value1;
_value2 = value2;
}
/// <summary>
/// The first value.
/// </summary>
public TValue1 Value1
{
get { return _value1; }
}
/// <summary>
/// The second value.
/// </summary>
public TValue2 Value2
{
get { return _value2; }
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public bool Equals(Tuple<TValue1, TValue2> other)
{
return _value1.Equals(other._value1) &&
_value2.Equals(other._value2);
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public override bool Equals(object obj)
{
return (obj is Tuple<TValue1, TValue2>) &&
Equals((Tuple<TValue1, TValue2>)obj);
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public static bool operator ==(Tuple<TValue1, TValue2> value1, Tuple<TValue1, TValue2> value2)
{
return value1.Equals(value2);
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public static bool operator !=(Tuple<TValue1, TValue2> value1, Tuple<TValue1, TValue2> value2)
{
return !(value1 == value2);
}
/// <summary>
/// A hash code for a tuple is a xor its values.
/// </summary>
public override int GetHashCode()
{
return _value1.GetHashCode() ^ _value2.GetHashCode();
}
private readonly TValue1 _value1;
private readonly TValue2 _value2;
}
}
\ No newline at end of file
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\bin\Debug\PcapDotNet.Core.Extensions.XML</DocumentationFile> <DocumentationFile>..\..\bin\Debug\PcapDotNet.Core.Extensions.XML</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\bin\Release\PcapDotNet.Core.Extensions.XML</DocumentationFile> <DocumentationFile>..\..\bin\Release\PcapDotNet.Core.Extensions.XML</DocumentationFile>
<RunCodeAnalysis>true</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\PcapDotNet.Packets\PcapDotNet.Packets.csproj"> <ProjectReference Include="..\PcapDotNet.Packets\PcapDotNet.Packets.csproj">
<Project>{8a184af5-e46c-482c-81a3-76d8ce290104}</Project> <Project>{8a184af5-e46c-482c-81a3-76d8ce290104}</Project>
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PcapDotNet.Packets.TestUtils</RootNamespace> <RootNamespace>PcapDotNet.Packets.TestUtils</RootNamespace>
<AssemblyName>PcapDotNet.Packets.TestUtils</AssemblyName> <AssemblyName>PcapDotNet.Packets.TestUtils</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName> <SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
......
...@@ -138,7 +138,7 @@ namespace PcapDotNet.Packets ...@@ -138,7 +138,7 @@ namespace PcapDotNet.Packets
} }
private Options(Tuple<IList<T>, bool> optionsAndIsValid) private Options(Tuple<IList<T>, bool> optionsAndIsValid)
: this(optionsAndIsValid.Value1, optionsAndIsValid.Value2) : this(optionsAndIsValid.Item1, optionsAndIsValid.Item2)
{ {
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PcapDotNet.Packets</RootNamespace> <RootNamespace>PcapDotNet.Packets</RootNamespace>
<AssemblyName>PcapDotNet.Packets</AssemblyName> <AssemblyName>PcapDotNet.Packets</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName> <SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
...@@ -48,7 +49,7 @@ ...@@ -48,7 +49,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>true</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRules> <CodeAnalysisRules>
</CodeAnalysisRules> </CodeAnalysisRules>
<DocumentationFile>..\..\bin\Debug\PcapDotNet.Packets.XML</DocumentationFile> <DocumentationFile>..\..\bin\Debug\PcapDotNet.Packets.XML</DocumentationFile>
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunCodeAnalysis>true</RunCodeAnalysis> <RunCodeAnalysis>false</RunCodeAnalysis>
<CodeAnalysisRules> <CodeAnalysisRules>
</CodeAnalysisRules> </CodeAnalysisRules>
<DocumentationFile>..\..\bin\Release\PcapDotNet.Packets.XML</DocumentationFile> <DocumentationFile>..\..\bin\Release\PcapDotNet.Packets.XML</DocumentationFile>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PcapDotNet.TestUtils</RootNamespace> <RootNamespace>PcapDotNet.TestUtils</RootNamespace>
<AssemblyName>PcapDotNet.TestUtils</AssemblyName> <AssemblyName>PcapDotNet.TestUtils</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName> <SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment