Пример #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 TodoItemReviewerRule();
            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 ProcessRuleAsyncPass(int priority, string expectedReviewer)
        {
            var request = CreateRequest();

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

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

            Assert.AreEqual(expectedReviewer, response.Item.Reviewer);

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

            Assert.AreEqual(0, response.Notifications.Count);
        }
Пример #3
0
        public async Task ProcessRuleAsyncPriorityIsNotInRange(int priority)
        {
            var request = CreateRequest();

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

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

            Assert.AreEqual(null, response.Item.Reviewer);

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

            VerifyNotification.AssertResponseNotifications(CreateExpectedResponse(priority), response);
        }