コード例 #1
0
        private void ExecuteAction(UserAction action)
        {
            var actionType = action.GetType();
            var executor   = _executors[actionType];

            var executeMethod = typeof(IUserActionExecutor <>).MakeGenericType(actionType).GetMethod("Execute");

            executeMethod.Invoke(executor, new object[] { action });
        }
コード例 #2
0
 public void testClickButton(int abili, int userID, int cardID, Type expected)
 {
     try
     {
         UserActionHandler handler = new UserActionHandler(game);
         handler.ClickUser    = userID;
         handler.SelectCardId = cardID;
         handler.Ifabi        = abili;
         UserAction action = handler.clickOK(1);
         if (expected == null)
         {
             Assert.Fail("Should throw an exception");
         }
         Assert.AreEqual(expected, action.GetType());
     }
     catch (InvalidOperationException e) {
         if (expected != null)
         {
             Assert.Fail("Should not throw an exception");
         }
     }
 }
コード例 #3
0
 private string GetContentPartialViewName(UserAction forAction)
 {
     return(string.Format("_{0}", Enum.GetName(forAction.GetType(), forAction)));
 }