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
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DictionaryEqualsNullTest()
{
Assert.IsFalse(new Dictionary<int, int>().DictionaryEquals(new Dictionary<int, int>(), null));
......
......@@ -73,6 +73,7 @@
<Compile Include="MemberInfoExtensionsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropertyInfoExtensionsTests.cs" />
<Compile Include="SequenceTest.cs" />
<Compile Include="SerialNumber32Test.cs" />
<Compile Include="UInt128Tests.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
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void OverflowAddTest()
{
SerialNumber32 serialNumber = 1;
......
......@@ -80,7 +80,7 @@ namespace PcapDotNet.Base.Test
}
[TestMethod]
[ExpectedException(typeof(OverflowException))]
[ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void CastToULongOverflow()
{
Random random = new Random();
......@@ -99,7 +99,7 @@ namespace PcapDotNet.Base.Test
}
[TestMethod]
[ExpectedException(typeof(OverflowException))]
[ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void ParseOverflow()
{
Assert.AreEqual(0, UInt128.Parse("-1"));
......
......@@ -62,7 +62,7 @@ namespace PcapDotNet.Base.Test
}
[TestMethod]
[ExpectedException(typeof(OverflowException))]
[ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void ParseTooBigTest()
{
UInt48 value = UInt48.Parse(ulong.MaxValue.ToString());
......@@ -70,7 +70,7 @@ namespace PcapDotNet.Base.Test
}
[TestMethod]
[ExpectedException(typeof(OverflowException))]
[ExpectedException(typeof(OverflowException), AllowDerivedTypes = false)]
public void ParseTooBigTestEvenForUInt64()
{
UInt48 value = UInt48.Parse(ulong.MaxValue + "0");
......
......@@ -333,7 +333,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void GetStatisticsOnCaptureModeErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -344,7 +344,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void GetPacketOnStatisticsModeErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -356,7 +356,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetInvalidModeErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -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
// [TestMethod]
// [ExpectedException(typeof(InvalidOperationException))]
// [ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
// public void SetBigKernelBufferSizeErrorTest()
// {
// using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -377,7 +377,7 @@ namespace PcapDotNet.Core.Test
// }
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetPacketErrorTest()
{
const string SourceMac = "11:22:33:44:55:66";
......@@ -395,7 +395,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetSomePacketsErrorTest()
{
const string SourceMac = "11:22:33:44:55:66";
......@@ -414,7 +414,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetPacketsErrorTest()
{
const string SourceMac = "11:22:33:44:55:66";
......@@ -450,7 +450,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetNextStatisticsErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -465,7 +465,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetSmallKernelBufferSizeGetStatisticsErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -602,7 +602,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodOneEveryNErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -612,7 +612,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodFirstAfterIntervalNegativeMsErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -622,7 +622,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodFirstAfterIntervalNegativeTimespanErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -632,7 +632,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void SetSamplingMethodFirstAfterIntervalBigTimespanErrorTest()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......@@ -642,7 +642,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetInvalidDataLink()
{
using (PacketCommunicator communicator = OpenLiveDevice())
......
......@@ -114,7 +114,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void StatisticsModeErrorTest()
{
using (PacketCommunicator communicator = OpenOfflineDevice())
......@@ -137,7 +137,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void GetTotalStatisticsErrorTest()
{
using (PacketCommunicator communicator = OpenOfflineDevice())
......@@ -147,7 +147,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void OpenInvalidFileTest()
{
using (new OfflinePacketDevice("myinvalidfile").Open())
......@@ -157,7 +157,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void OpenNullFilenameTest()
{
using (new OfflinePacketDevice(null).Open())
......@@ -167,7 +167,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SendPacketErrorTest()
{
using (PacketCommunicator communicator = OpenOfflineDevice())
......@@ -177,7 +177,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetKernelBufferSizeErrorTest()
{
using (PacketCommunicator communicator = OpenOfflineDevice())
......@@ -187,7 +187,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void SetlKernelMinimumBytesToCopyErrorTest()
{
using (PacketCommunicator communicator = OpenOfflineDevice())
......@@ -244,14 +244,14 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DumpToBadFileTest()
{
OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, "??");
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void EmptyNameTest()
{
OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, string.Empty);
......
......@@ -52,7 +52,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void TransmitQueueToOfflineTest()
{
const string SourceMac = "11:22:33:44:55:66";
......
......@@ -71,7 +71,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(NotSupportedException))]
[ExpectedException(typeof(NotSupportedException), AllowDerivedTypes = false)]
public void UnsupportedKindErrorTest()
{
PcapDataLink dataLink = new PcapDataLink();
......@@ -79,7 +79,7 @@ namespace PcapDotNet.Core.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void NoDescriptionErrorTest()
{
PcapDataLink dataLink = GetInvalidDataLink();
......
......@@ -91,7 +91,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayCompareFirstNullTest()
{
Assert.IsNotNull(ByteArrayExtensions.Compare(null, 1, new byte[1], 0, 1));
......@@ -99,7 +99,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayCompareSecondNullTest()
{
Assert.IsNotNull(new byte[1].Compare(1, null, 0, 1));
......@@ -107,7 +107,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayFindNullArrayTest()
{
Assert.IsNotNull(ByteArrayExtensions.Find(null, 1, 1, new byte[1]));
......@@ -115,7 +115,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayFindNullOtherTest()
{
Assert.IsNotNull(new byte[5].Find(1, 1, null));
......@@ -129,7 +129,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArraySequenceEqualNullArrayTest()
{
Assert.IsNotNull(ByteArrayExtensions.SequenceEqual(null, 1, new byte[1], 0, 1));
......@@ -137,7 +137,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void ByteArrayWriteNullEncodingTest()
{
int offset = 0;
......
......@@ -167,7 +167,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DnsCompressionInvalidModeTest()
{
DnsLayer dnsLayer = new DnsLayer
......@@ -188,7 +188,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsDomainNameConstructorNullStringTest()
{
DnsDomainName domainName = new DnsDomainName(null);
......@@ -230,7 +230,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DnsQueryResourceRecordTtlGetTest()
{
var query = new DnsQueryResourceRecord(DnsDomainName.Root, DnsType.A, DnsClass.Internet);
......@@ -239,7 +239,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void DnsQueryResourceRecordDataGetTest()
{
var query = new DnsQueryResourceRecord(DnsDomainName.Root, DnsType.A, DnsClass.Internet);
......@@ -263,7 +263,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainTooBigDnsType()
{
DnsResourceDataNextDomain resourceData = new DnsResourceDataNextDomain(new DnsDomainName("a.b.c"), DataSegment.Empty);
......@@ -272,7 +272,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
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});
......@@ -282,7 +282,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainZeroEndedBitmapTest()
{
DataSegment bitmap = new DataSegment(new byte[] { 1, 0 });
......@@ -302,7 +302,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainConstructorNullTypeBitmapTest()
{
var resourceData = new DnsResourceDataNextDomain(DnsDomainName.Root, null);
......@@ -311,7 +311,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainCreateTypeBitmapNullInputTest()
{
var bitmap = DnsResourceDataNextDomain.CreateTypeBitmap(null);
......@@ -357,7 +357,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
[ExpectedException(typeof(ArgumentException), AllowDerivedTypes = false)]
public void DnsResourceDataNamingAuthorityPointerIllegalFlagsTest()
{
var resourceData = new DnsResourceDataNamingAuthorityPointer(0, 0, new DataSegment(new[] {(byte)'%'}),
......@@ -368,7 +368,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyConstructorNullKeyTest()
{
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
......@@ -378,7 +378,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyConstructorNullOtherTest()
{
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
......@@ -388,7 +388,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyTooBigKeyTest()
{
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
......@@ -398,7 +398,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionKeyTooBigOtherTest()
{
var resourceData = new DnsResourceDataTransactionKey(DnsDomainName.Root, 0, 0, DnsTransactionKeyMode.KeyDeletion, DnsResponseCode.NoError,
......@@ -419,7 +419,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureConstructorNullMessageAuthenticationCodeTest()
{
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, null, 0, DnsResponseCode.NoError, DataSegment.Empty);
......@@ -428,7 +428,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureConstructorNullOtherTest()
{
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, DataSegment.Empty, 0, DnsResponseCode.NoError, null);
......@@ -437,7 +437,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureTooBigMessageAuthenticationCodeTest()
{
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, new DataSegment(new byte[ushort.MaxValue + 1]), 0,
......@@ -447,7 +447,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataTransactionSignatureTooBigOtherTest()
{
var resourceData = new DnsResourceDataTransactionSignature(DnsDomainName.Root, 0, 0, DataSegment.Empty, 0,
......@@ -468,7 +468,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolTooBigHostIdentityTagTest()
{
var resourceData = new DnsResourceDataHostIdentityProtocol(new DataSegment(new byte[byte.MaxValue + 1]), DnsPublicKeyAlgorithm.None,
......@@ -478,7 +478,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolTooBigPublicKeyTest()
{
var resourceData = new DnsResourceDataHostIdentityProtocol(DataSegment.Empty, DnsPublicKeyAlgorithm.None,
......@@ -488,7 +488,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolConstructorNullHostIdentityTagTest()
{
var resourceData = new DnsResourceDataHostIdentityProtocol(null, DnsPublicKeyAlgorithm.None, DataSegment.Empty, new DnsDomainName[0]);
......@@ -497,7 +497,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataHostIdentityProtocolConstructorNullPublicKeyTest()
{
var resourceData = new DnsResourceDataHostIdentityProtocol(DataSegment.Empty, DnsPublicKeyAlgorithm.None, null, new DnsDomainName[0]);
......@@ -520,7 +520,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataLocationInformationInvalidSizeTest()
{
var resourceData = new DnsResourceDataLocationInformation(0, 9000000001L, 0, 0, 0, 0, 0);
......@@ -529,7 +529,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataLocationInformationInvalidHorizontalPrecisionTest()
{
var resourceData = new DnsResourceDataLocationInformation(0, 0, 9000000001L, 0, 0, 0, 0);
......@@ -538,7 +538,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataLocationInformationInvalidVerticalPrecisionTest()
{
var resourceData = new DnsResourceDataLocationInformation(0, 0, 0, 9000000001L, 0, 0, 0);
......@@ -571,7 +571,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNetworkServiceAccessPointAreaAddressTooSmallTest()
{
var resourceData = new DnsResourceDataNetworkServiceAccessPoint(DataSegment.Empty, 0, 0);
......@@ -587,7 +587,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNetworkServiceAccessPointConstructorNullAreaAddressTest()
{
var resourceData = new DnsResourceDataNetworkServiceAccessPoint(null, 0, 0);
......@@ -603,7 +603,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsAddressPrefixAddressFamilyDependentPartTooBigTest()
{
var dnsAddressPrefix = new DnsAddressPrefix(AddressFamily.IpV4, 0, false, new DataSegment(new byte[128]));
......@@ -619,7 +619,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsAddressPrefixConstructorNullAddressFamilyDependentPartTtest()
{
var dnsAddressPrefix = new DnsAddressPrefix(AddressFamily.IpV4, 0, false, null);
......@@ -628,7 +628,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainSecure3NextHashedOwnerNameTooBigTest()
{
var resourceData = new DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm.Sha1, DnsSecNSec3Flags.None, 0, DataSegment.Empty,
......@@ -638,7 +638,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNextDomainSecure3SaltTooBigTest()
{
var resourceData = new DnsResourceDataNextDomainSecure3(DnsSecNSec3HashAlgorithm.Sha1, DnsSecNSec3Flags.None, 0,
......@@ -686,7 +686,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataCertificationAuthorityAuthorizationTagTooBigTest()
{
var resourceData = new DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags.Critical,
......@@ -696,7 +696,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataCertificationAuthorityAuthorizationConstructorNullTagTest()
{
var resourceData = new DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags.Critical, null,
......@@ -715,7 +715,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataA6ConstructorAddressSuffixTooSmallTest()
{
var resourceData = new DnsResourceDataA6(127, IpV6Address.Zero, DnsDomainName.Root);
......@@ -724,7 +724,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataA6ConstructorAddressSuffixTooBigTest()
{
var resourceData = new DnsResourceDataA6(1, IpV6Address.MaxValue, DnsDomainName.Root);
......@@ -751,7 +751,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNInfoConstructorNullStringsTest()
{
var resourceData = new DnsResourceDataNInfo(null as ReadOnlyCollection<DataSegment>);
......@@ -760,7 +760,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void DnsResourceDataNInfoConstructorTooFewStringsTest()
{
var resourceData = new DnsResourceDataNInfo();
......@@ -849,7 +849,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataDelegationSignerConstructorNullDigestTest()
{
var resourceData = new DnsResourceDataDelegationSigner(1, DnsAlgorithm.PrivateDns, DnsDigestType.Sha1, null);
......@@ -882,7 +882,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void DnsResourceDataNamingAuthorityPointerConstructorNullFlagsTest()
{
var resourceData = new DnsResourceDataNamingAuthorityPointer(1, 2, null, DataSegment.Empty, DataSegment.Empty, DnsDomainName.Root);
......
......@@ -450,7 +450,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
[ExpectedException(typeof(ArgumentException), AllowDerivedTypes = false)]
public void HttpRequestMethodBadKnownTest()
{
Assert.IsNotNull(new HttpRequestMethod(HttpRequestKnownMethod.Unknown));
......@@ -532,7 +532,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void HttpCreateFieldNullEncoding()
{
HttpField field = HttpField.CreateField("abc", "cde", null);
......@@ -541,7 +541,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[ExpectedException(typeof(ArgumentNullException), AllowDerivedTypes = false)]
public void HttpCreateFieldNullName()
{
HttpField field = HttpField.CreateField(null, "cde");
......
......@@ -133,7 +133,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3SmallMaxResponseTimeTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
......@@ -148,7 +148,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3BigMaxResponseTimeTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
......@@ -163,7 +163,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3SmallQueryIntervalTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
......@@ -178,7 +178,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion3BigQueryIntervalTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
......@@ -193,7 +193,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion2SmallMaxResponseTimeTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now,
......@@ -208,7 +208,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpQueryVersion2BigMaxResponseTimeTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(),
......@@ -345,7 +345,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void IgmpIllegalReportVersionTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpReportVersion1Layer());
......@@ -363,7 +363,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void IgmpIllegalQueryVersionTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpQueryVersion1Layer());
......@@ -406,7 +406,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void IgmpExtractLayerBadMessageTypeTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpReportVersion1Layer());
......@@ -419,7 +419,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IgmpTooBigQueryRobustnessVariableTest()
{
Packet packet = PacketBuilder.Build(DateTime.Now, new EthernetLayer(), new IpV4Layer(), new IgmpQueryVersion3Layer
......
......@@ -158,7 +158,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionTimestampOverflowErrorTest()
{
Random random = new Random();
......@@ -168,7 +168,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionTimestampPointedIndexErrorTest()
{
Random random = new Random();
......@@ -223,7 +223,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionRoutePointedAddressIndexErrorTest()
{
Random random = new Random();
......@@ -336,7 +336,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionBasicSecurityConstructorBadLengthTest()
{
IpV4OptionBasicSecurity option = new IpV4OptionBasicSecurity(IpV4OptionSecurityClassificationLevel.Secret, IpV4OptionSecurityProtectionAuthorities.None, 1);
......@@ -429,7 +429,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV4OptionQuickStartBadRateTest()
{
IpV4OptionQuickStart option = new IpV4OptionQuickStart(IpV4OptionQuickStartFunction.RateRequest, 100, 1, 32);
......
......@@ -174,7 +174,7 @@ namespace PcapDotNet.Packets.Test
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(InvalidOperationException), AllowDerivedTypes = false)]
public void TcpOptionMoodBadEmotionStringTest()
{
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