public Service(string vmx_file, VMWareInfo.VMCoreTypes vm_target) : base() { SetServiceBehavior(); _vmx_file = vmx_file; try { if (IsUsingApi) { _control = new VMControllerByAPI(vm_target); } else { _control = new VMControllerByVMRun(vm_target); } } catch (VMXServiceException) { _invalid_state = true; WriteLog("Failed To Initialize VMWare controller!", EventLogEntryType.Error); return; } if (!File.Exists(_vmx_file)) { WriteLog("Specified vmx file '{0}' does not exists!", EventLogEntryType.FailureAudit, _vmx_file); _invalid_state = true; return; } _timer = new Timer(TimeSpan.FromSeconds(20).TotalMilliseconds); _timer.Elapsed += new ElapsedEventHandler(OnTimerEvent); _timer.Enabled = false; }
protected override void Dispose(bool disposing) { if (_control != null) { _control.Dispose(); _control = null; } base.Dispose(disposing); }
public void StopVMXTest() { IVMController target = CreateIVMController(); bool expected = true; bool actual; actual = target.StopVMX(vmx); Assert.AreEqual(expected, actual); //Assert.Inconclusive("このテストメソッドの正確性を確認します。"); }
public void IsRunningTest() { IVMController target = CreateIVMController(); IVMController vmrun = new VMControllerByVMRun(new VMWareInfo().VMCore); bool expected = vmrun.IsRunning(vmx); bool actual; actual = target.IsRunning(vmx); Assert.AreEqual(expected, actual); //Assert.Inconclusive("このテストメソッドの正確性を確認します。"); }