protected static void CheckPrefixPacket( DHCPv6Packet result, DHCPv6PacketTypes type, DHCPv6PrefixDelegation prefixDelegation) { Assert.NotNull(result); Assert.NotEqual(DHCPv6Packet.Empty, result); Assert.True(result.IsValid); Assert.Equal(type, result.PacketType); var iaOption = result.GetPrefixDelegationIdentiyAssocation(prefixDelegation.IdentityAssociation); Assert.NotNull(iaOption); var uncastedSuboption = iaOption.Suboptions.First(); Assert.NotNull(uncastedSuboption); Assert.IsAssignableFrom <DHCPv6PacketIdentityAssociationPrefixDelegationSuboption>(uncastedSuboption); var addressSubOption = (DHCPv6PacketIdentityAssociationPrefixDelegationSuboption)uncastedSuboption; Assert.Equal(prefixDelegation.Mask.Identifier, addressSubOption.PrefixLength); Assert.Equal(prefixDelegation.NetworkAddress, addressSubOption.Address); Assert.NotEmpty(addressSubOption.Suboptions); Assert.Single(addressSubOption.Suboptions); var uncastedSubSuboption = addressSubOption.Suboptions.First(); Assert.NotNull(uncastedSubSuboption); Assert.IsAssignableFrom <DHCPv6PacketStatusCodeSuboption>(uncastedSubSuboption); var statusSubOption = (DHCPv6PacketStatusCodeSuboption)uncastedSubSuboption; Assert.Equal((UInt16)DHCPv6StatusCodes.Success, statusSubOption.StatusCode); Assert.False(String.IsNullOrEmpty(statusSubOption.Message)); }