public void ArePropertiesAndValuesValid_KeyIsMissing() { var input = new[] { new Dictionary <String, String> { { "NetworkAddress", "someVaue" }, { "SubnetMask2", "ohter" } }, new Dictionary <String, String> { { "SubnetMask", "someVaue" }, { "NetworkAddress2", "ohter" } }, }; var resolver = new DHCPv6RelayAgentSubnetResolver(); foreach (var item in input) { Boolean actual = resolver.ArePropertiesAndValuesValid(item, Mock.Of <ISerializer>(MockBehavior.Strict)); Assert.False(actual); } }
public void ArePropertiesAndValuesValid(String ipAddress, Byte subnetmaskLength, Boolean shouldBeValid) { IPv6Address address = IPv6Address.FromString(ipAddress); IPv6SubnetMask mask = new IPv6SubnetMask(new IPv6SubnetMaskIdentifier(subnetmaskLength)); Mock <ISerializer> serializerMock = new Mock <ISerializer>(MockBehavior.Strict); serializerMock.Setup(x => x.Deserialze <IPv6Address>(ipAddress)).Returns(address).Verifiable(); serializerMock.Setup(x => x.Deserialze <IPv6SubnetMask>(subnetmaskLength.ToString())).Returns(mask).Verifiable(); var resolver = new DHCPv6RelayAgentSubnetResolver(); Boolean actual = resolver.ArePropertiesAndValuesValid(new Dictionary <String, String> { { "NetworkAddress", ipAddress }, { "SubnetMask", subnetmaskLength.ToString() }, }, serializerMock.Object); Assert.Equal(shouldBeValid, actual); serializerMock.Verify(); }