private void VerifyMockVMActionInvoked(MockVMConnection vm, VMActionType actionType, params string[] parameters)
        {
            bool found = false;

            foreach (VMAction action in vm.History)
            {
                if (action.Action == actionType)
                {
                    bool parametersDifferent = false;
                    if (parameters.Length == action.Params.Length)
                    {
                        for (int i = 0; i < parameters.Length; i++)
                        {
                            if (parameters[i] != action.Params[i])
                            {
                                parametersDifferent = true;
                            }
                        }
                    }
                    else
                    {
                        parametersDifferent = true;
                    }
                    if (!parametersDifferent)
                    {
                        found = true;
                    }
                }
            }
            Assert.True(found, "Could not find action \"{0}\" with params \"{1}\" for VM \"{2}\"", actionType.ToString(), string.Join(", ", parameters), vm._VMName);
        }
        private bool WaitForVMAction(MockVMConnection vm, VMActionType actionType, DateTime minimumTime, TimeSpan timeout)
        {
            DateTime start = DateTime.Now;

            while (DateTime.Now - start < timeout)
            {
                foreach (VMAction action in vm.History)
                {
                    if (action.Time >= minimumTime && action.Action == actionType)
                    {
                        return(true);
                    }
                }
                System.Threading.Thread.Sleep(100);
            }
            return(false);
        }
Ejemplo n.º 3
0
 public VMAction(VMActionType action, params string[] parameters)
 {
     this.Time   = DateTime.Now;
     this.Action = action;
     this.Params = parameters;
 }
Ejemplo n.º 4
0
 public VMAction(VMActionType action)
 {
     this.Time   = DateTime.Now;
     this.Action = action;
     this.Params = new string[0];
 }
 private void VerifyMockVMActionInvoked(MockVMConnection vm, VMActionType actionType)
 {
     VerifyMockVMActionInvoked(vm, actionType, new string[0]);
 }
 private bool WaitForVMAction(MockVMConnection vm, VMActionType actionType, DateTime minimumTime, TimeSpan timeout)
 {
     DateTime start = DateTime.Now;
     while (DateTime.Now - start < timeout)
     {
         foreach (VMAction action in vm.History)
         {
             if (action.Time >= minimumTime && action.Action == actionType)
             {
                 return true;
             }
         }
         System.Threading.Thread.Sleep(100);
     }
     return false;
 }
 private void VerifyMockVMActionInvoked(MockVMConnection vm, VMActionType actionType, params string[] parameters)
 {
     bool found = false;
     foreach (VMAction action in vm.History)
     {
         if (action.Action == actionType)
         {
             bool parametersDifferent = false;
             if (parameters.Length == action.Params.Length)
             {
                 for (int i = 0; i < parameters.Length; i++)
                 {
                     if (parameters[i] != action.Params[i])
                     {
                         parametersDifferent = true;
                     }
                 }
             }
             else
             {
                 parametersDifferent = true;
             }
             if (!parametersDifferent)
             {
                 found = true;
             }
         }
     }
     Assert.True(found, "Could not find action \"{0}\" with params \"{1}\" for VM \"{2}\"", actionType.ToString(), string.Join(", ", parameters), vm._VMName);
 }
 private void VerifyMockVMActionInvoked(MockVMConnection vm, VMActionType actionType)
 {
     VerifyMockVMActionInvoked(vm, actionType, new string[0]);
 }
 public VMAction(VMActionType action, params string[] parameters)
 {
     this.Time = DateTime.Now;
     this.Action = action;
     this.Params = parameters;
 }
 public VMAction(VMActionType action)
 {
     this.Time = DateTime.Now;
     this.Action = action;
     this.Params = new string[0];
 }