Ejemplo n.º 1
0
 public void should_not_have_called_executable_process()
 {
     Setup();
     SetProviderData.Execute(ProviderData);
     ExecutableProcessQueue.AssertWasNotCalled(
         queue => queue.Enqueue(Arg <string> .Is.Equal("netsh"), Arg <string> .Is.Anything));
     Logger.AssertWasCalled(l => l.Log("Role Names did not match. Roles names from provider data fake role1,fake role2. Role names from configuration rax_managed,rack_connect"));
 }
        public void should_not_set_the_same_label_again()
        {
            NetworkInterface.label = "Lan1";
            SetNetworkInterface.Execute(new List <NetworkInterface> {
                NetworkInterface
            });

            ExecutableProcessQueue.AssertWasNotCalled(x => x.Enqueue("netsh", "interface set interface name=\"Lan1\" newname=\"Lan1\""));
        }
        public void should_not_set_diff_name_if_set_interface_name_fails_for_more_than_retry_attempts()
        {
            const int noOfRetries = SetNetworkInterface.NO_OF_RETRIES_FOR_SETTING_INTERFACE_NAME;

            ExecutableProcessQueue.Expect(x => x.Go()).Throw(new UnsuccessfulCommandExecutionException("something", new ExecutableResult())).Repeat.Times(noOfRetries + 1);
            SetNetworkInterface.Execute(new List <NetworkInterface> {
                NetworkInterface
            });
            ExecutableProcessQueue.AssertWasNotCalled(
                x => x.Enqueue("netsh", string.Format("interface set interface name=\"Lan1\" newname=\"Front End{0}\"", noOfRetries + 1)));
        }
Ejemplo n.º 4
0
        public void should_not_have_called_executable_process_because_white_list_ips_count_is_less_than_zero()
        {
            Setup();

            ProviderData.white_List_Ips = new List <string>();
            ProviderData.roles          = new List <string>()
            {
                "rax_managed", "rack_connect"
            };

            SetProviderData.Execute(ProviderData);
            ExecutableProcessQueue.AssertWasNotCalled(
                queue => queue.Enqueue(Arg <string> .Is.Equal("netsh"), Arg <string> .Is.Anything));
            Logger.AssertWasCalled(l => l.Log("White List Ips not available. Firewall rules will not be added/updated."));
        }
 public void should_configure_the_interface_correctly_for_one_ip_with_the_gateway()
 {
     SetNetworkInterface.Execute(new List <NetworkInterface> {
         NetworkInterface
     });
     ExecutableProcessQueue.AssertWasCalled(
         x =>
         x.Enqueue("netsh",
                   "interface ip add address name=\"Lan1\" addr=192.168.1.110 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=2"));
     ExecutableProcessQueue.AssertWasNotCalled(
         x =>
         x.Enqueue("netsh",
                   "interface ip add address name=\"Lan1\" addr=1.2.2.2 mask=255.255.0.0 gateway=192.168.1.1 gwmetric=2"));
     ExecutableProcessQueue.AssertWasNotCalled(
         x =>
         x.Enqueue("netsh",
                   "interface ip add address name=\"Lan1\" addr=1.2.2.2 mask=255.255.0.0"));
 }
 public void should_not_call_the_dns_configuration()
 {
     ExecutableProcessQueue.AssertWasNotCalled(
         x => x.Enqueue("netsh", "interface ip set dns name=\"Lan1\" source=dhcp"));
 }