Esempio n. 1
0
        public void ArePropertiesAndValuesValid_Failed_PropertiesAreNotSeralizble()
        {
            Random random = new Random();

            UInt32 enterpriseNumber = random.NextUInt32();

            DHCPv6RemoteIdentifierEnterpriseNumberResolver resolver = new DHCPv6RemoteIdentifierEnterpriseNumberResolver(
                Mock.Of <ILogger <DHCPv6RemoteIdentifierEnterpriseNumberResolver> >());

            List <Dictionary <String, String> > inputs = new List <Dictionary <string, string> >
            {
                new Dictionary <String, String>
                {
                    { "EnterpriseNumber", enterpriseNumber.ToString() },
                    { "RelayAgentIndex", 4.ToString() },
                },
                new Dictionary <String, String>
                {
                    { "EnterpriseNumber", enterpriseNumber.ToString() },
                    { "RelayAgentIndex", 4.ToString() },
                }
            };

            foreach (var item in inputs)
            {
                Boolean result = resolver.ArePropertiesAndValuesValid(item, Mock.Of <ISerializer>(MockBehavior.Strict));
                Assert.False(result);
            }
        }
Esempio n. 2
0
        public void ArePropertiesAndValuesValid(Int32?agentIndex)
        {
            Random random = new Random();

            UInt32 enterpriseNumber = random.NextUInt32();

            DHCPv6RemoteIdentifierEnterpriseNumberResolver resolver = new DHCPv6RemoteIdentifierEnterpriseNumberResolver(
                Mock.Of <ILogger <DHCPv6RemoteIdentifierEnterpriseNumberResolver> >());

            Mock <ISerializer> serializerMock = new Mock <ISerializer>(MockBehavior.Strict);

            serializerMock.Setup(x => x.Deserialze <UInt32>(enterpriseNumber.ToString())).Returns(enterpriseNumber).Verifiable();
            serializerMock.Setup(x => x.Deserialze <Int32?>(agentIndex.ToString())).Returns(agentIndex).Verifiable();

            Boolean actual = resolver.ArePropertiesAndValuesValid(new Dictionary <String, String>
            {
                { "EnterpriseNumber", enterpriseNumber.ToString() },
                { "RelayAgentIndex", agentIndex.ToString() },
            }, serializerMock.Object);

            Assert.True(actual);

            serializerMock.Verify();
        }