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;
......
...@@ -167,7 +167,7 @@ namespace PcapDotNet.Packets.Test ...@@ -167,7 +167,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DnsCompressionInvalidModeTest() public void DnsCompressionInvalidModeTest()
{ {
DnsLayer dnsLayer = new DnsLayer DnsLayer dnsLayer = new DnsLayer
...@@ -188,7 +188,7 @@ namespace PcapDotNet.Packets.Test ...@@ -188,7 +188,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsDomainNameConstructorNullStringTest() public void DnsDomainNameConstructorNullStringTest()
{ {
DnsDomainName domainName = new DnsDomainName(null); DnsDomainName domainName = new DnsDomainName(null);
...@@ -230,7 +230,7 @@ namespace PcapDotNet.Packets.Test ...@@ -230,7 +230,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DnsQueryResourceRecordTtlGetTest() public void DnsQueryResourceRecordTtlGetTest()
{ {
var query = new DnsQueryResourceRecord(DnsDomainName.Root, DnsType.A, DnsClass.Internet); var query = new DnsQueryResourceRecord(DnsDomainName.Root, DnsType.A, DnsClass.Internet);
...@@ -239,7 +239,7 @@ namespace PcapDotNet.Packets.Test ...@@ -239,7 +239,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(InvalidOperationException))] [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DnsQueryResourceRecordDataGetTest() public void DnsQueryResourceRecordDataGetTest()
{ {
var query = new DnsQueryResourceRecord(DnsDomainName.Root, DnsType.A, DnsClass.Internet); var query = new DnsQueryResourceRecord(DnsDomainName.Root, DnsType.A, DnsClass.Internet);
...@@ -263,7 +263,7 @@ namespace PcapDotNet.Packets.Test ...@@ -263,7 +263,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainTooBigDnsType() public void DnsResourceDataNextDomainTooBigDnsType()
{ {
DnsResourceDataNextDomain resourceData = new DnsResourceDataNextDomain(new DnsDomainName("a.b.c"), DataSegment.Empty); DnsResourceDataNextDomain resourceData = new DnsResourceDataNextDomain(new DnsDomainName("a.b.c"), DataSegment.Empty);
...@@ -272,7 +272,7 @@ namespace PcapDotNet.Packets.Test ...@@ -272,7 +272,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainTooLongBitmapTest() public void DnsResourceDataNextDomainTooLongBitmapTest()
{ {
DataSegment bitmap = new DataSegment(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}); DataSegment bitmap = new DataSegment(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17});
...@@ -282,7 +282,7 @@ namespace PcapDotNet.Packets.Test ...@@ -282,7 +282,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainZeroEndedBitmapTest() public void DnsResourceDataNextDomainZeroEndedBitmapTest()
{ {
DataSegment bitmap = new DataSegment(new byte[] { 1, 0 }); DataSegment bitmap = new DataSegment(new byte[] { 1, 0 });
...@@ -302,7 +302,7 @@ namespace PcapDotNet.Packets.Test ...@@ -302,7 +302,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainConstructorNullTypeBitmapTest() public void DnsResourceDataNextDomainConstructorNullTypeBitmapTest()
{ {
var resourceData = new DnsResourceDataNextDomain(DnsDomainName.Root, null); var resourceData = new DnsResourceDataNextDomain(DnsDomainName.Root, null);
...@@ -311,7 +311,7 @@ namespace PcapDotNet.Packets.Test ...@@ -311,7 +311,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainCreateTypeBitmapNullInputTest() public void DnsResourceDataNextDomainCreateTypeBitmapNullInputTest()
{ {
var bitmap = DnsResourceDataNextDomain.CreateTypeBitmap(null); var bitmap = DnsResourceDataNextDomain.CreateTypeBitmap(null);
...@@ -357,7 +357,7 @@ namespace PcapDotNet.Packets.Test ...@@ -357,7 +357,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentException))] [ExpectedException(typeof(ArgumentException), AllowDerivedTypes = false)]
public void DnsResourceDataNamingAuthorityPointerIllegalFlagsTest() public void DnsResourceDataNamingAuthorityPointerIllegalFlagsTest()
{ {
var resourceData = new DnsResourceDataNamingAuthorityPointer(0, 0, new DataSegment(new[] {(byte)'%'}), var resourceData = new DnsResourceDataNamingAuthorityPointer(0, 0, new DataSegment(new[] {(byte)'%'}),
...@@ -368,7 +368,7 @@ namespace PcapDotNet.Packets.Test ...@@ -368,7 +368,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyConstructorNullKeyTest() public void DnsResourceDataTransactionKeyConstructorNullKeyTest()
{ {
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError, var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
...@@ -378,7 +378,7 @@ namespace PcapDotNet.Packets.Test ...@@ -378,7 +378,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyConstructorNullOtherTest() public void DnsResourceDataTransactionKeyConstructorNullOtherTest()
{ {
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError, var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
...@@ -388,7 +388,7 @@ namespace PcapDotNet.Packets.Test ...@@ -388,7 +388,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyTooBigKeyTest() public void DnsResourceDataTransactionKeyTooBigKeyTest()
{ {
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError, var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
...@@ -398,7 +398,7 @@ namespace PcapDotNet.Packets.Test ...@@ -398,7 +398,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyTooBigOtherTest() public void DnsResourceDataTransactionKeyTooBigOtherTest()
{ {
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError, var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
...@@ -419,7 +419,7 @@ namespace PcapDotNet.Packets.Test ...@@ -419,7 +419,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureConstructorNullMessageAuthenticationCodeTest() public void DnsResourceDataTransactionSignatureConstructorNullMessageAuthenticationCodeTest()
{ {
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, null, 0, DnsResponseCode.NoError, DataSegment.Empty); var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, null, 0, DnsResponseCode.NoError, DataSegment.Empty);
...@@ -428,7 +428,7 @@ namespace PcapDotNet.Packets.Test ...@@ -428,7 +428,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureConstructorNullOtherTest() public void DnsResourceDataTransactionSignatureConstructorNullOtherTest()
{ {
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, DataSegment.Empty, 0, DnsResponseCode.NoError, null); var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, DataSegment.Empty, 0, DnsResponseCode.NoError, null);
...@@ -437,7 +437,7 @@ namespace PcapDotNet.Packets.Test ...@@ -437,7 +437,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureTooBigMessageAuthenticationCodeTest() public void DnsResourceDataTransactionSignatureTooBigMessageAuthenticationCodeTest()
{ {
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, new DataSegment(new byte[ushort.MaxValue + 1]), 0, var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, new DataSegment(new byte[ushort.MaxValue + 1]), 0,
...@@ -447,7 +447,7 @@ namespace PcapDotNet.Packets.Test ...@@ -447,7 +447,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureTooBigOtherTest() public void DnsResourceDataTransactionSignatureTooBigOtherTest()
{ {
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, DataSegment.Empty, 0, var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, DataSegment.Empty, 0,
...@@ -468,7 +468,7 @@ namespace PcapDotNet.Packets.Test ...@@ -468,7 +468,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolTooBigHostIdentityTagTest() public void DnsResourceDataHostIdentityProtocolTooBigHostIdentityTagTest()
{ {
var resourceData = new DnsResourceDataHostIdentityProtocol(new DataSegment(new byte[byte.MaxValue + 1]), DnsPublicKeyAlgorithm.None, var resourceData = new DnsResourceDataHostIdentityProtocol(new DataSegment(new byte[byte.MaxValue + 1]), DnsPublicKeyAlgorithm.None,
...@@ -478,7 +478,7 @@ namespace PcapDotNet.Packets.Test ...@@ -478,7 +478,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolTooBigPublicKeyTest() public void DnsResourceDataHostIdentityProtocolTooBigPublicKeyTest()
{ {
var resourceData = new DnsResourceDataHostIdentityProtocol(DataSegment.Empty, DnsPublicKeyAlgorithm.None, var resourceData = new DnsResourceDataHostIdentityProtocol(DataSegment.Empty, DnsPublicKeyAlgorithm.None,
...@@ -488,7 +488,7 @@ namespace PcapDotNet.Packets.Test ...@@ -488,7 +488,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolConstructorNullHostIdentityTagTest() public void DnsResourceDataHostIdentityProtocolConstructorNullHostIdentityTagTest()
{ {
var resourceData = new DnsResourceDataHostIdentityProtocol(null, DnsPublicKeyAlgorithm.None, DataSegment.Empty, new DnsDomainName[0]); var resourceData = new DnsResourceDataHostIdentityProtocol(null, DnsPublicKeyAlgorithm.None, DataSegment.Empty, new DnsDomainName[0]);
...@@ -497,7 +497,7 @@ namespace PcapDotNet.Packets.Test ...@@ -497,7 +497,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolConstructorNullPublicKeyTest() public void DnsResourceDataHostIdentityProtocolConstructorNullPublicKeyTest()
{ {
var resourceData = new DnsResourceDataHostIdentityProtocol(DataSegment.Empty, DnsPublicKeyAlgorithm.None, null, new DnsDomainName[0]); var resourceData = new DnsResourceDataHostIdentityProtocol(DataSegment.Empty, DnsPublicKeyAlgorithm.None, null, new DnsDomainName[0]);
...@@ -520,7 +520,7 @@ namespace PcapDotNet.Packets.Test ...@@ -520,7 +520,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataLocationInformationInvalidSizeTest() public void DnsResourceDataLocationInformationInvalidSizeTest()
{ {
var resourceData = new DnsResourceDataLocationInformation(0, 9000000001L, 0, 0, 0, 0, 0); var resourceData = new DnsResourceDataLocationInformation(0, 9000000001L, 0, 0, 0, 0, 0);
...@@ -529,7 +529,7 @@ namespace PcapDotNet.Packets.Test ...@@ -529,7 +529,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataLocationInformationInvalidHorizontalPrecisionTest() public void DnsResourceDataLocationInformationInvalidHorizontalPrecisionTest()
{ {
var resourceData = new DnsResourceDataLocationInformation(0, 0, 9000000001L, 0, 0, 0, 0); var resourceData = new DnsResourceDataLocationInformation(0, 0, 9000000001L, 0, 0, 0, 0);
...@@ -538,7 +538,7 @@ namespace PcapDotNet.Packets.Test ...@@ -538,7 +538,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataLocationInformationInvalidVerticalPrecisionTest() public void DnsResourceDataLocationInformationInvalidVerticalPrecisionTest()
{ {
var resourceData = new DnsResourceDataLocationInformation(0, 0, 0, 9000000001L, 0, 0, 0); var resourceData = new DnsResourceDataLocationInformation(0, 0, 0, 9000000001L, 0, 0, 0);
...@@ -571,7 +571,7 @@ namespace PcapDotNet.Packets.Test ...@@ -571,7 +571,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNetworkServiceAccessPointAreaAddressTooSmallTest() public void DnsResourceDataNetworkServiceAccessPointAreaAddressTooSmallTest()
{ {
var resourceData = new DnsResourceDataNetworkServiceAccessPoint(DataSegment.Empty, 0, 0); var resourceData = new DnsResourceDataNetworkServiceAccessPoint(DataSegment.Empty, 0, 0);
...@@ -587,7 +587,7 @@ namespace PcapDotNet.Packets.Test ...@@ -587,7 +587,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNetworkServiceAccessPointConstructorNullAreaAddressTest() public void DnsResourceDataNetworkServiceAccessPointConstructorNullAreaAddressTest()
{ {
var resourceData = new DnsResourceDataNetworkServiceAccessPoint(null, 0, 0); var resourceData = new DnsResourceDataNetworkServiceAccessPoint(null, 0, 0);
...@@ -603,7 +603,7 @@ namespace PcapDotNet.Packets.Test ...@@ -603,7 +603,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsAddressPrefixAddressFamilyDependentPartTooBigTest() public void DnsAddressPrefixAddressFamilyDependentPartTooBigTest()
{ {
var dnsAddressPrefix = new DnsAddressPrefix(AddressFamily.IpV4, 0, false, new DataSegment(new byte[128])); var dnsAddressPrefix = new DnsAddressPrefix(AddressFamily.IpV4, 0, false, new DataSegment(new byte[128]));
...@@ -619,7 +619,7 @@ namespace PcapDotNet.Packets.Test ...@@ -619,7 +619,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsAddressPrefixConstructorNullAddressFamilyDependentPartTtest() public void DnsAddressPrefixConstructorNullAddressFamilyDependentPartTtest()
{ {
var dnsAddressPrefix = new DnsAddressPrefix(AddressFamily.IpV4, 0, false, null); var dnsAddressPrefix = new DnsAddressPrefix(AddressFamily.IpV4, 0, false, null);
...@@ -628,7 +628,7 @@ namespace PcapDotNet.Packets.Test ...@@ -628,7 +628,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainSecure3NextHashedOwnerNameTooBigTest() public void DnsResourceDataNextDomainSecure3NextHashedOwnerNameTooBigTest()
{ {
var resourceData = new DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm.Sha1, DnsSecNSec3Flags.None, 0, DataSegment.Empty, var resourceData = new DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm.Sha1, DnsSecNSec3Flags.None, 0, DataSegment.Empty,
...@@ -638,7 +638,7 @@ namespace PcapDotNet.Packets.Test ...@@ -638,7 +638,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainSecure3SaltTooBigTest() public void DnsResourceDataNextDomainSecure3SaltTooBigTest()
{ {
var resourceData = new DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm.Sha1, DnsSecNSec3Flags.None, 0, var resourceData = new DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm.Sha1, DnsSecNSec3Flags.None, 0,
...@@ -686,7 +686,7 @@ namespace PcapDotNet.Packets.Test ...@@ -686,7 +686,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataCertificationAuthorityAuthorizationTagTooBigTest() public void DnsResourceDataCertificationAuthorityAuthorizationTagTooBigTest()
{ {
var resourceData = new DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags.Critical, var resourceData = new DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags.Critical,
...@@ -696,7 +696,7 @@ namespace PcapDotNet.Packets.Test ...@@ -696,7 +696,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataCertificationAuthorityAuthorizationConstructorNullTagTest() public void DnsResourceDataCertificationAuthorityAuthorizationConstructorNullTagTest()
{ {
var resourceData = new DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags.Critical, null, var resourceData = new DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags.Critical, null,
...@@ -715,7 +715,7 @@ namespace PcapDotNet.Packets.Test ...@@ -715,7 +715,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataA6ConstructorAddressSuffixTooSmallTest() public void DnsResourceDataA6ConstructorAddressSuffixTooSmallTest()
{ {
var resourceData = new DnsResourceDataA6(127, IpV6Address.Zero, DnsDomainName.Root); var resourceData = new DnsResourceDataA6(127, IpV6Address.Zero, DnsDomainName.Root);
...@@ -724,7 +724,7 @@ namespace PcapDotNet.Packets.Test ...@@ -724,7 +724,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataA6ConstructorAddressSuffixTooBigTest() public void DnsResourceDataA6ConstructorAddressSuffixTooBigTest()
{ {
var resourceData = new DnsResourceDataA6(1, IpV6Address.MaxValue, DnsDomainName.Root); var resourceData = new DnsResourceDataA6(1, IpV6Address.MaxValue, DnsDomainName.Root);
...@@ -751,7 +751,7 @@ namespace PcapDotNet.Packets.Test ...@@ -751,7 +751,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNInfoConstructorNullStringsTest() public void DnsResourceDataNInfoConstructorNullStringsTest()
{ {
var resourceData = new DnsResourceDataNInfo(null as ReadOnlyCollection<DataSegment>); var resourceData = new DnsResourceDataNInfo(null as ReadOnlyCollection<DataSegment>);
...@@ -760,7 +760,7 @@ namespace PcapDotNet.Packets.Test ...@@ -760,7 +760,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNInfoConstructorTooFewStringsTest() public void DnsResourceDataNInfoConstructorTooFewStringsTest()
{ {
var resourceData = new DnsResourceDataNInfo(); var resourceData = new DnsResourceDataNInfo();
...@@ -849,7 +849,7 @@ namespace PcapDotNet.Packets.Test ...@@ -849,7 +849,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataDelegationSignerConstructorNullDigestTest() public void DnsResourceDataDelegationSignerConstructorNullDigestTest()
{ {
var resourceData = new DnsResourceDataDelegationSigner(1, DnsAlgorithm.PrivateDns, DnsDigestType.Sha1, null); var resourceData = new DnsResourceDataDelegationSigner(1, DnsAlgorithm.PrivateDns, DnsDigestType.Sha1, null);
...@@ -882,7 +882,7 @@ namespace PcapDotNet.Packets.Test ...@@ -882,7 +882,7 @@ namespace PcapDotNet.Packets.Test
} }
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentNullException))] [ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNamingAuthorityPointerConstructorNullFlagsTest() public void DnsResourceDataNamingAuthorityPointerConstructorNullFlagsTest()
{ {
var resourceData = new DnsResourceDataNamingAuthorityPointer(1, 2, null, DataSegment.Empty, DataSegment.Empty, DnsDomainName.Root); var resourceData = new DnsResourceDataNamingAuthorityPointer(1, 2, null, DataSegment.Empty, DataSegment.Empty, DnsDomainName.Root);
......
...@@ -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