public void ConfigurationRequestIllegalParameters()
        {
            Assert.Throws <ArgumentNullException>(
                delegate
            {
                ConfigurationRequest request = new ConfigurationRequest(null, "bla");
            },
                "no exception thrown if no configuration parameters set");

            Assert.Throws <ArgumentException>(
                delegate
            {
                ConfigurationDevice device        = new ConfigurationDevice("0009E5001231");
                ConfigurationNetSettings settings = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
                ConfigurationParams parameters    = new ConfigurationParams(device, settings);
                ConfigurationRequest request      = new ConfigurationRequest(parameters, null);
            },
                "no exception thrown if no query ID given");

            Assert.Throws <ArgumentException>(
                delegate
            {
                ConfigurationDevice device        = new ConfigurationDevice("0009E5001231");
                ConfigurationNetSettings settings = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
                ConfigurationParams parameters    = new ConfigurationParams(device, settings);
                ConfigurationRequest request      = new ConfigurationRequest(parameters, string.Empty);
            },
                "no exception thrown if empty query ID given");
        }
Exemple #2
0
        public void SendConfigurationTestDhcp()
        {
            ConfigurationService service = new ConfigurationService(this.parser, this);

            ConfigurationDevice      device     = new ConfigurationDevice("0009E5001231");
            ConfigurationNetSettings settings   = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
            ConfigurationParams      parameters = new ConfigurationParams(device, settings);

            service.SendConfiguration(parameters, this, 1000);
            Assert.True(this.gotSuccessResponse && !this.gotErrorResponse && !this.gotTimeout, "got timeout or error for correct configuration response");
        }
Exemple #3
0
        public void SendConfigurationErrorResponse()
        {
            this.response = ResponseType.responseError;
            ConfigurationService service = new ConfigurationService(this.parser, this);

            ConfigurationDevice      device     = new ConfigurationDevice("0009E5001231");
            ConfigurationNetSettings settings   = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
            ConfigurationParams      parameters = new ConfigurationParams(device, settings);

            service.SendConfiguration(parameters, this, 1000);
            Assert.True(!this.gotSuccessResponse && this.gotErrorResponse && !this.gotTimeout, "got no error callback if error response was sent");
        }
Exemple #4
0
        public void CloseWhileSendingConfiguration()
        {
            this.response = ResponseType.noResponse;
            ConfigurationService service = new ConfigurationService(this.parser, this);

            ConfigurationDevice      device     = new ConfigurationDevice("0009E5001231");
            ConfigurationNetSettings settings   = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
            ConfigurationParams      parameters = new ConfigurationParams(device, settings);

            service.SendConfiguration(parameters, this, 1000);
            service.Close();
            Assert.True(!this.gotSuccessResponse && !this.gotErrorResponse && !this.gotTimeout, "got callbacks after closing the service");
        }
Exemple #5
0
        public void SendConfigurationNoErrorNoResultResponse()
        {
            this.response = ResponseType.responseNoErrorNoResult;
            ConfigurationService service = new ConfigurationService(this.parser, this);

            ConfigurationDevice      device     = new ConfigurationDevice("0009E5001231");
            ConfigurationNetSettings settings   = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
            ConfigurationParams      parameters = new ConfigurationParams(device, settings);

            service.SendConfiguration(parameters, this, 10);
            Thread.Sleep(100);
            Assert.True(!this.gotSuccessResponse && !this.gotErrorResponse && this.gotTimeout, "got no timeout if response with no result/error was sent");
        }
Exemple #6
0
        public void SendConfigurationTestIPv6Gateway()
        {
            ConfigurationService service = new ConfigurationService(this.parser, this);

            ConfigurationDevice device  = new ConfigurationDevice("0009E5001231");
            DefaultGateway      gateway = new DefaultGateway();

            gateway.InternetProtocolV6Address = "2001:db8:85a3::8a2e:370:7334";
            ConfigurationNetSettings settings   = new ConfigurationNetSettings(gateway);
            ConfigurationParams      parameters = new ConfigurationParams(device, settings);

            service.SendConfiguration(parameters, this, 1000);
            Assert.True(this.gotSuccessResponse && !this.gotErrorResponse && !this.gotTimeout, "got timeout or error for correct configuration response");
        }
        public void DeviceInstantiationWithIllegalParameters()
        {
            Assert.Throws <ArgumentException>(
                delegate
            {
                ConfigurationDevice device = new ConfigurationDevice(null);
            },
                "Instantiation of ConfigurationDevice with null must fail");

            Assert.Throws <ArgumentException>(
                delegate
            {
                ConfigurationDevice device = new ConfigurationDevice(string.Empty);
            },
                "Instantiation of ConfigurationDevice with empty string must fail");
        }
Exemple #8
0
        public void IllegalParamatersTest()
        {
            ConfigurationService service = new ConfigurationService(this.parser, this);

            Assert.Throws <ArgumentNullException>(
                delegate
            {
                service.SendConfiguration(null, "bla", this, 1000);
            },
                "no exception thrown if no configuration parameter given");

            ConfigurationDevice      device     = new ConfigurationDevice("0009E5001231");
            ConfigurationNetSettings settings   = new ConfigurationNetSettings(new ConfigurationInterface("eth0", ConfigurationInterface.Method.Dhcp));
            ConfigurationParams      parameters = new ConfigurationParams(device, settings);

            Assert.Throws <ArgumentException>(
                delegate
            {
                service.SendConfiguration(parameters, null, this, 1000);
            },
                "no exception thrown if no query ID given");

            Assert.Throws <ArgumentNullException>(
                delegate
            {
                service.SendConfiguration(parameters, "foo", null, 1000);
            },
                "no exception thrown if no callbacks given");

            Assert.Throws <ArgumentException>(
                delegate
            {
                service.SendConfiguration(parameters, "foo", this, -10);
            },
                "no exception thrown if negative timeout given");
        }
Exemple #9
0
 public ConfigurationParams(ConfigurationDevice device, ConfigurationNetSettings cns)
 {
     this.Device      = device;
     this.NetSettings = cns;
     this.Ttl         = 1;
 }