Commit 27c3ee0f authored by Brickner_cp's avatar Brickner_cp

Code Coverage 95.15%

parent f122ddb1
......@@ -90,6 +90,7 @@ namespace PcapDotNet.Packets.Test
{
Assert.IsFalse(extensionHeaderMobility.Equals(2));
Assert.IsTrue(extensionHeaderMobility.Equals((object)extensionHeader));
Assert.AreEqual(extensionHeaderMobility.MobilityOptions, new IpV6MobilityOptions(extensionHeaderMobility.MobilityOptions).AsEnumerable());
foreach (IpV6MobilityOption option in extensionHeaderMobility.MobilityOptions)
{
switch (option.OptionType)
......@@ -130,6 +131,23 @@ namespace PcapDotNet.Packets.Test
IpV6MobilityOptionTimestamp optionTimestamp = (IpV6MobilityOptionTimestamp)option;
MoreAssert.IsBiggerOrEqual(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc), optionTimestamp.TimestampDateTime);
break;
case IpV6MobilityOptionType.FlowIdentification:
IpV6MobilityOptionFlowIdentification optionFlowIdentification = (IpV6MobilityOptionFlowIdentification)option;
foreach (IpV6FlowIdentificationSubOption subOption in optionFlowIdentification.SubOptions)
{
switch (subOption.OptionType)
{
case IpV6FlowIdentificationSubOptionType.BindingReference:
IpV6FlowIdentificationSubOptionBindingReference subOptionBindingReference =
(IpV6FlowIdentificationSubOptionBindingReference)subOption;
Assert.AreEqual(subOptionBindingReference,
new IpV6FlowIdentificationSubOptionBindingReference(
subOptionBindingReference.BindingIds.AsEnumerable()));
break;
}
}
break;
}
}
}
......@@ -379,5 +397,33 @@ namespace PcapDotNet.Packets.Test
new IpV6Address("0000:0000:9ABC:DEF0:1234:5678:9ABC:DEF0"),
new IpV6Address("0000:0001:9ABC:DEF0:1234:5678:9ABC:DEF0")));
}
[TestMethod]
[ExpectedException(typeof(ArgumentException), AllowDerivedTypes = false)]
public void IpV6OptionCalipsoCompartmentBitmapDoesntDivideBy4()
{
Assert.IsNull(new IpV6OptionCalipso(IpV6CalipsoDomainOfInterpretation.Null, 0, null, new DataSegment(new byte[6])));
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV6OptionCalipsoCompartmentBitmapTooLong()
{
Assert.IsNull(new IpV6OptionCalipso(IpV6CalipsoDomainOfInterpretation.Null, 0, null, new DataSegment(new byte[248])));
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV6OptionSmfDpdDefaultTaggerIdTooLong()
{
Assert.IsNull(new IpV6OptionSmfDpdDefault(new DataSegment(new byte[17]), DataSegment.Empty));
}
[TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException), AllowDerivedTypes = false)]
public void IpV6OptionSmfDpdDefaultTaggerIdTooShort()
{
Assert.IsNull(new IpV6OptionSmfDpdDefault(DataSegment.Empty, DataSegment.Empty));
}
}
}
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