public void TestDeleteVirtualMachine() { if (!_test.Config.RunWorkstationTests) { Assert.Ignore("Skipping, test requires server admin privileges for ESX, Workstation tests disabled."); } foreach (IVMWareTestProvider testProvider in _test.Providers) { VMWareVirtualMachine virtualMachine = testProvider.VirtualMachine; string vmxPathName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); ConsoleOutput.WriteLine("Creating linked clone: {0}", vmxPathName); Directory.CreateDirectory(vmxPathName); string vmxFileName = Path.Combine(vmxPathName, "Clone.vmx"); virtualMachine.Clone(VMWareVirtualMachineCloneType.Linked, vmxFileName); Assert.IsTrue(File.Exists(vmxFileName)); VMWareVirtualHost virtualHost = testProvider.ConnectedVirtualHost; VMWareVirtualMachine virtualMachineClone = virtualHost.Open(vmxFileName); virtualMachineClone.Delete(Constants.VIX_VMDELETE_DISK_FILES); Assert.IsFalse(File.Exists(vmxFileName)); Assert.IsFalse(Directory.Exists(vmxPathName)); } }