public void TestEmptyList()
 {
     var action = new DestroyPolicyAction(mockConnection.Object, new List<VMPP>());
     action.Completed += action_Completed;
     action.RunAsync();
     _autoResetEvent.WaitOne();
     Assert.True(action.Succeeded);
     mockProxy.VerifyAll();
 }
 public void TestOneInList()
 {
     mockProxy.Setup(x => x.vmpp_destroy(It.IsAny<string>(), "1")).Returns(new Response<string>(""));
     mockProxy.Setup(x => x.vm_set_protection_policy(It.IsAny<string>(), "1", It.IsAny<string>())).Returns(new Response<string>(""));
     var action = new DestroyPolicyAction(mockConnection.Object, new List<VMPP>()
     {new VMPP(){opaque_ref = "1",VMs = new List<XenRef<VM>>(){new XenRef<VM>("1")}}});
     action.Completed += action_Completed;
     action.RunAsync();
     _autoResetEvent.WaitOne();
     Assert.True(action.Succeeded,action.Exception!=null?action.Exception.ToString():"");
     mockProxy.VerifyAll();
     mockProxy.Verify(x => x.vm_set_protection_policy(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Once());
 }