public void should_configure_interface_with_all_the_present_dns_servers() { ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ip add dns name=\"Lan1\" addr=192.168.1.3 index=1")); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ip add dns name=\"Lan1\" addr=192.168.1.4 index=2")); }
public void should_configure_the_interface_correctly_with_the_gateway() { 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")); }
public void should_set_interface_name() { SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface set interface name=\"Lan1\" newname=\"Front End0\"")); }
public void should_configure_interface_with_the_dns_servers_as_dhcp() { SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ip set dns name=\"Lan1\" source=dhcp", new[] { "0", "1" })); }
public void should_set_the_interface_for_dhcp_first_before_configuring_it() { SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ip set address name=\"Lan1\" source=dhcp", new[] { "0", "1" })); }
public void should_call_enable_on_disabled_interfaces_whose_macs_are_absent() { SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface set interface name=\"Lan2\" admin=ENABLED")); }
public void should_try_to_diff_name_if_set_interface_name_fails() { ExecutableProcessQueue.Expect(x => x.Go()).Throw(new UnsuccessfulCommandExecutionException("something", new ExecutableResult())); SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface set interface name=\"Lan1\" newname=\"Front End1\"")); }
public void should_have_called_executable_process_when_firewall_rule_is_available_with_metadata() { Setup(); NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(true); UserMetadata.Add("build_config"); SetProviderData.Execute(ProviderData, UserMetadata); ExecutableProcessQueue.AssertWasCalled( queue => queue.Enqueue("netsh", "advfirewall firewall set rule name=\"RS_FIREWALL_RULE\" new enable=yes remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79")); }
public void should_configure_the_interface_correctly_for_both_ips_without_the_gateway() { NetworkInterface.gateway = null; 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")); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ip add address name=\"Lan1\" addr=1.2.2.2 mask=255.255.0.0")); }
public void should_try_set_to_diff_name_if_set_interface_name_fails_for_no_of_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); SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", string.Format("interface set interface name=\"Lan1\" newname=\"Front End{0}\"", noOfRetries))); }
public void should_have_called_executable_process_when_firewall_rule_is_not_available() { Setup(); NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(false); ProviderData.roles = new List <string>() { "rax_managed", "rack_connect" }; SetProviderData.Execute(ProviderData); ExecutableProcessQueue.AssertWasCalled( queue => queue.Enqueue("netsh", "advfirewall firewall add rule name=\"RS_FIREWALL_RULE\" enable=yes dir=in profile=public,private,domain localip=any remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79 protocol=tcp localport=445 remoteport=any edge=no action=allow")); }
public void should_have_called_executable_process_when_firewall_rule_is_available() { Setup(); NetshFirewallRuleNameAvailable.Stub(x => x.IsRuleAvailable(Constants.SoftwareFirewallRuleName)).Return(true); ProviderData.roles = new List <string>() { "rax_managed", "rack_connect" }; SetProviderData.Execute(ProviderData); ExecutableProcessQueue.AssertWasCalled( queue => queue.Enqueue("netsh", "advfirewall firewall set rule name=\"RS_FIREWALL_RULE\" new enable=yes remoteip=10.177.212.96,10.181.136.241,10.176.89.224,10.177.212.79")); }
public void should_set_ipv6_addresses() { SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ipv6 add address interface=\"Lan1\" address=2001:4801:787F:202:278E:89D8:FF06:B476/96")); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ipv6 add route prefix=::/0 interface=\"Lan1\" nexthop=fe80::def publish=Yes")); }
public void should_reset_ipv6_address_and_route_before_setting_ipv6_addresses() { _mockIPFinder.findIpv6Addresses("Lan1").Add(IPAddress.Parse("2001:4801:787F:202:278E:89D8:FF06:B476")); SetNetworkInterface.Execute(new List <NetworkInterface> { NetworkInterface }); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ipv6 delete address interface=\"Lan1\" address=2001:4801:787F:202:278E:89D8:FF06:B476")); ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface ipv6 delete route ::/0 \"Lan1\"", new[] { "0", "1" })); }
public void should_set_interface_name() { ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface set interface name=\"Lan1\" newname=\"Front End\"")); }
public void should_call_enable_on_disabled_interfaces_whose_macs_are_absent() { ExecutableProcessQueue.AssertWasCalled( x => x.Enqueue("netsh", "interface set interface name=\"Lan2\" admin=ENABLED")); // ExecutableProcessQueue.AssertWasCalled(x => x.Go()); }