Ejemplo n.º 1
0
        public void DHCPv4SimpleCiscoSGSeriesResolver_GetDescription()
        {
            DHCPv4SimpleCiscoSGSeriesResolver resolver = new DHCPv4SimpleCiscoSGSeriesResolver();

            ScopeResolverDescription description = resolver.GetDescription();

            Assert.NotNull(description);

            Assert.Equal(nameof(DHCPv4SimpleCiscoSGSeriesResolver), description.TypeName);

            Assert.NotNull(description.Properties);
            Assert.Equal(3, description.Properties.Count());

            {
                ScopeResolverPropertyDescription propertyDescription = description.Properties.First();

                Assert.Equal(nameof(DHCPv4SimpleCiscoSGSeriesResolver.VlanNumber), propertyDescription.PropertyName);
                Assert.Equal(ScopeResolverPropertyValueTypes.VLANId, propertyDescription.PropertyValueType);
            }
            {
                ScopeResolverPropertyDescription propertyDescription = description.Properties.ElementAt(1);

                Assert.Equal(nameof(DHCPv4SimpleCiscoSGSeriesResolver.PortNumber), propertyDescription.PropertyName);
                Assert.Equal(ScopeResolverPropertyValueTypes.Byte, propertyDescription.PropertyValueType);
            }
            {
                ScopeResolverPropertyDescription propertyDescription = description.Properties.ElementAt(2);

                Assert.Equal(nameof(DHCPv4SimpleCiscoSGSeriesResolver.DeviceMacAddress), propertyDescription.PropertyName);
                Assert.Equal(ScopeResolverPropertyValueTypes.ByteArray, propertyDescription.PropertyValueType);
            }
        }
Ejemplo n.º 2
0
        public void DHCPv4SimpleCiscoSGSeriesResolver_AreValuesValid_MissingKeys()
        {
            Random random = new Random();

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

            DHCPv4SimpleCiscoSGSeriesResolver resolver = new DHCPv4SimpleCiscoSGSeriesResolver();

            List <Dictionary <String, String> > invalidInputs = new List <Dictionary <string, string> >
            {
                null,
                new Dictionary <string, string>(),
                new Dictionary <string, string>()
                {
                    { random.GetAlphanumericString(10), random.GetAlphanumericString(10) }
                },
                new Dictionary <string, string>()
                {
                    //{ nameof(DHCPv4SimpleCiscoSGSeriesResolver.DeviceMacAddress), "f323abf23aa" },
                    { nameof(DHCPv4SimpleCiscoSGSeriesResolver.PortNumber), "2" },
                    { nameof(DHCPv4SimpleCiscoSGSeriesResolver.VlanNumber), "1" },
                },
                new Dictionary <string, string>()
                {
                    { nameof(DHCPv4SimpleCiscoSGSeriesResolver.DeviceMacAddress), "f323abf23aa" },
                    //{ nameof(DHCPv4SimpleCiscoSGSeriesResolver.PortNumber), "2" },
                    { nameof(DHCPv4SimpleCiscoSGSeriesResolver.VlanNumber), "1" },
                },
                new Dictionary <string, string>()
                {
                    { nameof(DHCPv4SimpleCiscoSGSeriesResolver.DeviceMacAddress), "f323abf23aa" },
                    { nameof(DHCPv4SimpleCiscoSGSeriesResolver.PortNumber), "2" },
                    //{ nameof(DHCPv4SimpleCiscoSGSeriesResolver.VlanNumber), "1" },
                },
            };

            foreach (var item in invalidInputs)
            {
                Boolean result = resolver.ArePropertiesAndValuesValid(item, mock.Object);
                Assert.False(result);
            }
        }