示例#1
0
        public async Task ProcessRuleAsyncSkipped(string scenario, object expectedRules)
        {
            var rules    = (List <IBaseRule <Request <TodoItem>, Response <TodoItemEntity> > >)expectedRules;
            var request  = CreateRequest();
            var response = CreateResponse();

            var rule = new TodoItemPriorityRule();
            await rule.ProcessAsync(request, response, rules);

            Assert.AreEqual(RuleStatusType.Skipped, rule.Status);
            Assert.IsTrue(rule.ContinueProcessing);

            Assert.AreEqual(0, response.Notifications.Count);
        }
示例#2
0
        public async Task ProcessRuleAsyncPriorityIsNotInRange(int priority)
        {
            var request = CreateRequest();

            request.Item.Priority = priority;
            var response = CreateResponse();

            var rule = new TodoItemPriorityRule();
            await rule.ProcessAsync(request, response, CreateBaseRulesWithRequiredRules());

            Assert.IsInstanceOfType(rule, typeof(BaseRule <Request <TodoItem>, Response <TodoItemEntity> >));
            Assert.AreEqual(RuleStatusType.Failed, rule.Status);
            Assert.IsTrue(rule.ContinueProcessing);

            VerifyNotification.AssertResponseNotifications(CreateExpectedResponse(), response);
        }
示例#3
0
        public async Task ProcessRuleAsyncPass(int priority)
        {
            var request = CreateRequest();

            request.Item.Priority = priority;
            var response = CreateResponse();

            var rule = new TodoItemPriorityRule();
            await rule.ProcessAsync(request, response, CreateBaseRulesWithRequiredRules());

            Assert.AreEqual(priority, response.Item.Priority);

            Assert.AreEqual(RuleStatusType.Passed, rule.Status);
            Assert.IsTrue(rule.ContinueProcessing);

            Assert.AreEqual(0, response.Notifications.Count);
        }