Commit 7a662074 authored by Brickner_cp's avatar Brickner_cp

Code coverage 95.51%

Never accept derived exceptions when an expecting an expcetion in the tests.
parent 3b8d552a
...@@ -77,7 +77,7 @@ namespace PcapDotNet.Base.Test ...@@ -77,7 +77,7 @@ namespace PcapDotNet.Base.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DictionaryEqualsNullTest() public void DictionaryEqualsNullTest()
{ {
Assert.IsFalse(new Dictionary<int, int>().DictionaryEquals(new Dictionary<int, int>(), null)); Assert.IsFalse(new Dictionary<int, int>().DictionaryEquals(new Dictionary<int, int>(), null));
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<Compile Include="MemberInfoExtensionsTests.cs" /> <Compile Include="MemberInfoExtensionsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropertyInfoExtensionsTests.cs" /> <Compile Include="PropertyInfoExtensionsTests.cs" />
<Compile Include="SequenceTest.cs" />
<Compile Include="SerialNumber32Test.cs" /> <Compile Include="SerialNumber32Test.cs" />
<Compile Include="UInt128Tests.cs" /> <Compile Include="UInt128Tests.cs" />
<Compile Include="UInt24Tests.cs" /> <Compile Include="UInt24Tests.cs" />
......
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace PcapDotNet.Base.Test
{
/// <summary>
/// Summary description for SequenceTest
/// </summary>
[TestClass]
public class SequenceTest
{
/// <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]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void GetHashCodeNullValue1Test()
{
Assert.IsNotNull(Sequence.GetHashCode(null, 1));
Assert.Fail();
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void GetHashCodeNullValue2Test()
{
Assert.IsNotNull(Sequence.GetHashCode(1, null));
Assert.Fail();
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void GetHashCodeNullValue3Test()
{
Assert.IsNotNull(Sequence.GetHashCode(1, 2, null));
Assert.Fail();
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void GetHashCodeNullValuesTest()
{
Assert.IsNotNull(Sequence.GetHashCode(null));
Assert.Fail();
}
}
}
\ No newline at end of file
...@@ -66,7 +66,7 @@ namespace PcapDotNet.Base.Test ...@@ -66,7 +66,7 @@ namespace PcapDotNet.Base.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void OverflowAddTest() public void OverflowAddTest()
{ {
SerialNumber32 serialNumber = 1; SerialNumber32 serialNumber = 1;
......
...@@ -80,7 +80,7 @@ namespace PcapDotNet.Base.Test ...@@ -80,7 +80,7 @@ namespace PcapDotNet.Base.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(OverflowException))] [ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void CastToULongOverflow() public void CastToULongOverflow()
{ {
Random random = new Random(); Random random = new Random();
...@@ -99,7 +99,7 @@ namespace PcapDotNet.Base.Test ...@@ -99,7 +99,7 @@ namespace PcapDotNet.Base.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(OverflowException))] [ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void ParseOverflow() public void ParseOverflow()
{ {
Assert.AreEqual(0, UInt128.Parse("-1")); Assert.AreEqual(0, UInt128.Parse("-1"));
......
...@@ -62,7 +62,7 @@ namespace PcapDotNet.Base.Test ...@@ -62,7 +62,7 @@ namespace PcapDotNet.Base.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(OverflowException))] [ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void ParseTooBigTest() public void ParseTooBigTest()
{ {
UInt48 value = UInt48.Parse(ulong.MaxValue.ToString()); UInt48 value = UInt48.Parse(ulong.MaxValue.ToString());
...@@ -70,7 +70,7 @@ namespace PcapDotNet.Base.Test ...@@ -70,7 +70,7 @@ namespace PcapDotNet.Base.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(OverflowException))] [ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void ParseTooBigTestEvenForUInt64() public void ParseTooBigTestEvenForUInt64()
{ {
UInt48 value = UInt48.Parse(ulong.MaxValue + "0"); UInt48 value = UInt48.Parse(ulong.MaxValue + "0");
......
...@@ -333,7 +333,7 @@ namespace PcapDotNet.Core.Test ...@@ -333,7 +333,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void GetStatisticsOnCaptureModeErrorTest() public void GetStatisticsOnCaptureModeErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -344,7 +344,7 @@ namespace PcapDotNet.Core.Test ...@@ -344,7 +344,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void GetPacketOnStatisticsModeErrorTest() public void GetPacketOnStatisticsModeErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -356,7 +356,7 @@ namespace PcapDotNet.Core.Test ...@@ -356,7 +356,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetInvalidModeErrorTest() public void SetInvalidModeErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -367,7 +367,7 @@ namespace PcapDotNet.Core.Test ...@@ -367,7 +367,7 @@ namespace PcapDotNet.Core.Test
// this test is removed for now since it doens't throw an exception for such big value // this test is removed for now since it doens't throw an exception for such big value
// [TestMethod] // [TestMethod]
// [ExpectedException(typeof(InvalidOperationException))] // [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
// public void SetBigKernelBufferSizeErrorTest() // public void SetBigKernelBufferSizeErrorTest()
// { // {
// using (PacketCommunicator communicator = OpenLiveDevice()) // using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -377,7 +377,7 @@ namespace PcapDotNet.Core.Test ...@@ -377,7 +377,7 @@ namespace PcapDotNet.Core.Test
// } // }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetPacketErrorTest() public void SetSmallKernelBufferSizeGetPacketErrorTest()
{ {
const string SourceMac = "11:22:33:44:55:66"; const string SourceMac = "11:22:33:44:55:66";
...@@ -395,7 +395,7 @@ namespace PcapDotNet.Core.Test ...@@ -395,7 +395,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetSomePacketsErrorTest() public void SetSmallKernelBufferSizeGetSomePacketsErrorTest()
{ {
const string SourceMac = "11:22:33:44:55:66"; const string SourceMac = "11:22:33:44:55:66";
...@@ -414,7 +414,7 @@ namespace PcapDotNet.Core.Test ...@@ -414,7 +414,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetPacketsErrorTest() public void SetSmallKernelBufferSizeGetPacketsErrorTest()
{ {
const string SourceMac = "11:22:33:44:55:66"; const string SourceMac = "11:22:33:44:55:66";
...@@ -450,7 +450,7 @@ namespace PcapDotNet.Core.Test ...@@ -450,7 +450,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetNextStatisticsErrorTest() public void SetSmallKernelBufferSizeGetNextStatisticsErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -465,7 +465,7 @@ namespace PcapDotNet.Core.Test ...@@ -465,7 +465,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetStatisticsErrorTest() public void SetSmallKernelBufferSizeGetStatisticsErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -602,7 +602,7 @@ namespace PcapDotNet.Core.Test ...@@ -602,7 +602,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodOneEveryNErrorTest() public void SetSamplingMethodOneEveryNErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -612,7 +612,7 @@ namespace PcapDotNet.Core.Test ...@@ -612,7 +612,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodFirstAfterIntervalNegativeMsErrorTest() public void SetSamplingMethodFirstAfterIntervalNegativeMsErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -622,7 +622,7 @@ namespace PcapDotNet.Core.Test ...@@ -622,7 +622,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodFirstAfterIntervalNegativeTimespanErrorTest() public void SetSamplingMethodFirstAfterIntervalNegativeTimespanErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -632,7 +632,7 @@ namespace PcapDotNet.Core.Test ...@@ -632,7 +632,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodFirstAfterIntervalBigTimespanErrorTest() public void SetSamplingMethodFirstAfterIntervalBigTimespanErrorTest()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
...@@ -642,7 +642,7 @@ namespace PcapDotNet.Core.Test ...@@ -642,7 +642,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetInvalidDataLink() public void SetInvalidDataLink()
{ {
using (PacketCommunicator communicator = OpenLiveDevice()) using (PacketCommunicator communicator = OpenLiveDevice())
......
...@@ -114,7 +114,7 @@ namespace PcapDotNet.Core.Test ...@@ -114,7 +114,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void StatisticsModeErrorTest() public void StatisticsModeErrorTest()
{ {
using (PacketCommunicator communicator = OpenOfflineDevice()) using (PacketCommunicator communicator = OpenOfflineDevice())
...@@ -137,7 +137,7 @@ namespace PcapDotNet.Core.Test ...@@ -137,7 +137,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void GetTotalStatisticsErrorTest() public void GetTotalStatisticsErrorTest()
{ {
using (PacketCommunicator communicator = OpenOfflineDevice()) using (PacketCommunicator communicator = OpenOfflineDevice())
...@@ -147,7 +147,7 @@ namespace PcapDotNet.Core.Test ...@@ -147,7 +147,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void OpenInvalidFileTest() public void OpenInvalidFileTest()
{ {
using (new OfflinePacketDevice("myinvalidfile").Open()) using (new OfflinePacketDevice("myinvalidfile").Open())
...@@ -157,7 +157,7 @@ namespace PcapDotNet.Core.Test ...@@ -157,7 +157,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void OpenNullFilenameTest() public void OpenNullFilenameTest()
{ {
using (new OfflinePacketDevice(null).Open()) using (new OfflinePacketDevice(null).Open())
...@@ -167,7 +167,7 @@ namespace PcapDotNet.Core.Test ...@@ -167,7 +167,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SendPacketErrorTest() public void SendPacketErrorTest()
{ {
using (PacketCommunicator communicator = OpenOfflineDevice()) using (PacketCommunicator communicator = OpenOfflineDevice())
...@@ -177,7 +177,7 @@ namespace PcapDotNet.Core.Test ...@@ -177,7 +177,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetKernelBufferSizeErrorTest() public void SetKernelBufferSizeErrorTest()
{ {
using (PacketCommunicator communicator = OpenOfflineDevice()) using (PacketCommunicator communicator = OpenOfflineDevice())
...@@ -187,7 +187,7 @@ namespace PcapDotNet.Core.Test ...@@ -187,7 +187,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetlKernelMinimumBytesToCopyErrorTest() public void SetlKernelMinimumBytesToCopyErrorTest()
{ {
using (PacketCommunicator communicator = OpenOfflineDevice()) using (PacketCommunicator communicator = OpenOfflineDevice())
...@@ -244,14 +244,14 @@ namespace PcapDotNet.Core.Test ...@@ -244,14 +244,14 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DumpToBadFileTest() public void DumpToBadFileTest()
{ {
OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, "??"); OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, "??");
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void EmptyNameTest() public void EmptyNameTest()
{ {
OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, string.Empty); OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, string.Empty);
......
...@@ -7,8 +7,8 @@ namespace PcapDotNet.Core.Test ...@@ -7,8 +7,8 @@ namespace PcapDotNet.Core.Test
{ {
internal class PacketHandler internal class PacketHandler
{ {
public PacketHandler(Packet expectedPacket, DateTime expectedMinTimestamp, DateTime expectedMaxTimestamp, public PacketHandler(Packet expectedPacket, DateTime expectedMinTimestamp, DateTime expectedMaxTimestamp,
PacketCommunicator communicator, int numPacketsToBreakLoop) PacketCommunicator communicator, int numPacketsToBreakLoop)
{ {
_expectedPacket = expectedPacket; _expectedPacket = expectedPacket;
_expectedMinTimestamp = expectedMinTimestamp; _expectedMinTimestamp = expectedMinTimestamp;
......
...@@ -52,7 +52,7 @@ namespace PcapDotNet.Core.Test ...@@ -52,7 +52,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void TransmitQueueToOfflineTest() public void TransmitQueueToOfflineTest()
{ {
const string SourceMac = "11:22:33:44:55:66"; const string SourceMac = "11:22:33:44:55:66";
......
...@@ -71,7 +71,7 @@ namespace PcapDotNet.Core.Test ...@@ -71,7 +71,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(NotSupportedException))] [ExpectedException(typeof(NotSupportedException), AllowDerivedTypes = false)]
public void UnsupportedKindErrorTest() public void UnsupportedKindErrorTest()
{ {
PcapDataLink dataLink = new PcapDataLink(); PcapDataLink dataLink = new PcapDataLink();
...@@ -79,7 +79,7 @@ namespace PcapDotNet.Core.Test ...@@ -79,7 +79,7 @@ namespace PcapDotNet.Core.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void NoDescriptionErrorTest() public void NoDescriptionErrorTest()
{ {
PcapDataLink dataLink = GetInvalidDataLink(); PcapDataLink dataLink = GetInvalidDataLink();
......
...@@ -91,7 +91,7 @@ namespace PcapDotNet.Packets.Test ...@@ -91,7 +91,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayCompareFirstNullTest() public void ByteArrayCompareFirstNullTest()
{ {
Assert.IsNotNull(ByteArrayExtensions.Compare(null, 1, new byte[1], 0, 1)); Assert.IsNotNull(ByteArrayExtensions.Compare(null, 1, new byte[1], 0, 1));
...@@ -99,7 +99,7 @@ namespace PcapDotNet.Packets.Test ...@@ -99,7 +99,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayCompareSecondNullTest() public void ByteArrayCompareSecondNullTest()
{ {
Assert.IsNotNull(new byte[1].Compare(1, null, 0, 1)); Assert.IsNotNull(new byte[1].Compare(1, null, 0, 1));
...@@ -107,7 +107,7 @@ namespace PcapDotNet.Packets.Test ...@@ -107,7 +107,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayFindNullArrayTest() public void ByteArrayFindNullArrayTest()
{ {
Assert.IsNotNull(ByteArrayExtensions.Find(null, 1, 1, new byte[1])); Assert.IsNotNull(ByteArrayExtensions.Find(null, 1, 1, new byte[1]));
...@@ -115,7 +115,7 @@ namespace PcapDotNet.Packets.Test ...@@ -115,7 +115,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayFindNullOtherTest() public void ByteArrayFindNullOtherTest()
{ {
Assert.IsNotNull(new byte[5].Find(1, 1, null)); Assert.IsNotNull(new byte[5].Find(1, 1, null));
...@@ -129,7 +129,7 @@ namespace PcapDotNet.Packets.Test ...@@ -129,7 +129,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArraySequenceEqualNullArrayTest() public void ByteArraySequenceEqualNullArrayTest()
{ {
Assert.IsNotNull(ByteArrayExtensions.SequenceEqual(null, 1, new byte[1], 0, 1)); Assert.IsNotNull(ByteArrayExtensions.SequenceEqual(null, 1, new byte[1], 0, 1));
...@@ -137,7 +137,7 @@ namespace PcapDotNet.Packets.Test ...@@ -137,7 +137,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayWriteNullEncodingTest() public void ByteArrayWriteNullEncodingTest()
{ {
int offset = 0; int offset = 0;
......
...@@ -450,7 +450,7 @@ namespace PcapDotNet.Packets.Test ...@@ -450,7 +450,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentException))] [ExpectedException(typeof(ArgumentException), AllowDerivedTypes = false)]
public void HttpRequestMethodBadKnownTest() public void HttpRequestMethodBadKnownTest()
{ {
Assert.IsNotNull(new HttpRequestMethod(HttpRequestKnownMethod.Unknown)); Assert.IsNotNull(new HttpRequestMethod(HttpRequestKnownMethod.Unknown));
...@@ -532,7 +532,7 @@ namespace PcapDotNet.Packets.Test ...@@ -532,7 +532,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void HttpCreateFieldNullEncoding() public void HttpCreateFieldNullEncoding()
{ {
HttpField field = HttpField.CreateField("abc", "cde", null); HttpField field = HttpField.CreateField("abc", "cde", null);
...@@ -541,7 +541,7 @@ namespace PcapDotNet.Packets.Test ...@@ -541,7 +541,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void HttpCreateFieldNullName() public void HttpCreateFieldNullName()
{ {
HttpField field = HttpField.CreateField(null, "cde"); HttpField field = HttpField.CreateField(null, "cde");
......
...@@ -133,7 +133,7 @@ namespace PcapDotNet.Packets.Test ...@@ -133,7 +133,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3SmallMaxResponseTimeTest() public void IgmpQueryVersion3SmallMaxResponseTimeTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
...@@ -148,7 +148,7 @@ namespace PcapDotNet.Packets.Test ...@@ -148,7 +148,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3BigMaxResponseTimeTest() public void IgmpQueryVersion3BigMaxResponseTimeTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
...@@ -163,7 +163,7 @@ namespace PcapDotNet.Packets.Test ...@@ -163,7 +163,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3SmallQueryIntervalTest() public void IgmpQueryVersion3SmallQueryIntervalTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
...@@ -178,7 +178,7 @@ namespace PcapDotNet.Packets.Test ...@@ -178,7 +178,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3BigQueryIntervalTest() public void IgmpQueryVersion3BigQueryIntervalTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
...@@ -193,7 +193,7 @@ namespace PcapDotNet.Packets.Test ...@@ -193,7 +193,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion2SmallMaxResponseTimeTest() public void IgmpQueryVersion2SmallMaxResponseTimeTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, Packet packet = PacketBuilder.Build(DateTime.Now,
...@@ -208,7 +208,7 @@ namespace PcapDotNet.Packets.Test ...@@ -208,7 +208,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion2BigMaxResponseTimeTest() public void IgmpQueryVersion2BigMaxResponseTimeTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
...@@ -345,7 +345,7 @@ namespace PcapDotNet.Packets.Test ...@@ -345,7 +345,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void IgmpIllegalReportVersionTest() public void IgmpIllegalReportVersionTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpReportVersion1Layer()); Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpReportVersion1Layer());
...@@ -363,7 +363,7 @@ namespace PcapDotNet.Packets.Test ...@@ -363,7 +363,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void IgmpIllegalQueryVersionTest() public void IgmpIllegalQueryVersionTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpQueryVersion1Layer()); Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpQueryVersion1Layer());
...@@ -406,7 +406,7 @@ namespace PcapDotNet.Packets.Test ...@@ -406,7 +406,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void IgmpExtractLayerBadMessageTypeTest() public void IgmpExtractLayerBadMessageTypeTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpReportVersion1Layer()); Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpReportVersion1Layer());
...@@ -419,7 +419,7 @@ namespace PcapDotNet.Packets.Test ...@@ -419,7 +419,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpTooBigQueryRobustnessVariableTest() public void IgmpTooBigQueryRobustnessVariableTest()
{ {
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpQueryVersion3Layer Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpQueryVersion3Layer
......
...@@ -158,7 +158,7 @@ namespace PcapDotNet.Packets.Test ...@@ -158,7 +158,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionTimestampOverflowErrorTest() public void IpV4OptionTimestampOverflowErrorTest()
{ {
Random random = new Random(); Random random = new Random();
...@@ -168,7 +168,7 @@ namespace PcapDotNet.Packets.Test ...@@ -168,7 +168,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionTimestampPointedIndexErrorTest() public void IpV4OptionTimestampPointedIndexErrorTest()
{ {
Random random = new Random(); Random random = new Random();
...@@ -223,7 +223,7 @@ namespace PcapDotNet.Packets.Test ...@@ -223,7 +223,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionRoutePointedAddressIndexErrorTest() public void IpV4OptionRoutePointedAddressIndexErrorTest()
{ {
Random random = new Random(); Random random = new Random();
...@@ -336,7 +336,7 @@ namespace PcapDotNet.Packets.Test ...@@ -336,7 +336,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionBasicSecurityConstructorBadLengthTest() public void IpV4OptionBasicSecurityConstructorBadLengthTest()
{ {
IpV4OptionBasicSecurity option = new IpV4OptionBasicSecurity(IpV4OptionSecurityClassificationLevel.Secret, IpV4OptionSecurityProtectionAuthorities.None, 1); IpV4OptionBasicSecurity option = new IpV4OptionBasicSecurity(IpV4OptionSecurityClassificationLevel.Secret, IpV4OptionSecurityProtectionAuthorities.None, 1);
...@@ -429,7 +429,7 @@ namespace PcapDotNet.Packets.Test ...@@ -429,7 +429,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionQuickStartBadRateTest() public void IpV4OptionQuickStartBadRateTest()
{ {
IpV4OptionQuickStart option = new IpV4OptionQuickStart(IpV4OptionQuickStartFunction.RateRequest, 100, 1, 32); IpV4OptionQuickStart option = new IpV4OptionQuickStart(IpV4OptionQuickStartFunction.RateRequest, 100, 1, 32);
......
...@@ -174,7 +174,7 @@ namespace PcapDotNet.Packets.Test ...@@ -174,7 +174,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void TcpOptionMoodBadEmotionStringTest() public void TcpOptionMoodBadEmotionStringTest()
{ {
Assert.IsNotNull(new TcpOptionMood((TcpOptionMoodEmotion)202).EmotionString); Assert.IsNotNull(new TcpOptionMood((TcpOptionMoodEmotion)202).EmotionString);
......
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