public void SetIPTest() { VirtualMachineRepository vmr = new VirtualMachineRepository(); VirtualMachine vm = vmr.GetAllRegisteredVirtualMachines().GetEnumerator().Current; // TODO: Initialize to an appropriate value RegisteredVirtualMachineService target = new RegisteredVirtualMachineService(vm); // TODO: Initialize to an appropriate value string oldIP = target.GetIP(); //set the new IP to the same first several sets of characters, but change the last few string value = oldIP.Substring(0, oldIP.LastIndexOf('.')) + ".200"; target.SetIP(value); string newIP = target.GetIP(); target.SetIP(oldIP); Assert.Equals(newIP, value); }
private void SetIPHostname(RegisteredVirtualMachineService service, bool retry = true) { try { System.Threading.Thread.Sleep(12 * 1000); service.SetHostname(VM.Hostname); System.Threading.Thread.Sleep(8 * 1000); service.SetIP(VM.IP.ToString()); System.Threading.Thread.Sleep(8 * 1000); } catch (Exception ex) { if (retry) SetIPHostname(service, false); else new SchedulerInfo("Error setting IP or hostname of new VM, will need to be manually set but will continue", ex).LogElmah(); } }