public void It_should_ask_the_complaint_severity_service_for_all_severities()
        {
            //Arrange
            var severities = TestUtilities.GetTestComplaintSeverities();

            A.CallTo(() => _complaintSeverityService.GetAll(A <Expression <Func <ComplaintSeverity, bool> >[]> .That.IsSameSequenceAs(TestUtilities.EmptyComplaintSeverityFilters()))).Returns(severities);

            //Act
            var result = _controller.Complain() as ViewResult;

            //Assert
            A.CallTo(() => _complaintSeverityService.GetAll(A <Expression <Func <ComplaintSeverity, bool> >[]> .That.IsSameSequenceAs(TestUtilities.EmptyComplaintSeverityFilters()))).MustHaveHappened(Repeated.Exactly.Once);
        }
示例#2
0
        private void PopulateCreateComplaintModel(CreateComplaintViewModel model)
        {
            var severities      = _complaintSeverityService.GetAll();
            var defaultSeverity = severities.Where(s => s.IsDefault).FirstOrDefault();
            var tags            = _tagService.GetAll();

            model.Severities = severities.Select(s => new SelectListItem()
            {
                Text     = s.Name,
                Selected = s.IsDefault,
                Value    = s.Id.ToString()
            });

            model.SelectedComplaintSeverityId = defaultSeverity == null ? (Guid?)null : defaultSeverity.Id;
            model.ExistingTags = tags.Select(t => _tagBuilder.BuildViewModel(t)).ToList();
        }