コード例 #1
0
        public virtual IActionBase CreateAction(EActionMethod method)
        {
            IActionBase action = null;

            switch (method)
            {
            case EActionMethod.ADD:
                action = AddTask.GetInstance();
                break;

            case EActionMethod.FIND:
                action = FindTasks.GetInstance();
                break;

            case EActionMethod.FINDYESTERDAY:
                action = FindYesterdayTasks.GetInstance();
                break;

            case EActionMethod.FINDTODAY:
                action = FindTodayTasks.GetInstance();
                break;

            default:
                break;
            }
            return(action);
        }
コード例 #2
0
        public void CreateAction_CheckAllEnumOptions_FindMissing()
        {
            var actionBases = new List <string>()
            {
                AddTask.GetInstance().GetType().ToString(),
                FindTasks.GetInstance().GetType().ToString(),
                FindYesterdayTasks.GetInstance().GetType().ToString(),
                FindTodayTasks.GetInstance().GetType().ToString(),
            };

            string message = string.Empty;

            for (int i = 0; i < Enum.GetNames(typeof(EActionMethod)).Length; i++)
            {
                try
                {
                    var enumChecker = (EActionMethod)i;
                    message = $"Missing action {enumChecker.ToString()}";
                    var createActionTypeResult = mainController.CreateAction(enumChecker).GetType().ToString();

                    Assert.That(createActionTypeResult, Is.EqualTo(actionBases[i]));
                }
                catch (Exception)
                {
                    Assert.Fail(message);
                }
            }
        }
コード例 #3
0
 public void Setup()
 {
     addTask = AddTask.GetInstance();
 }