Exemplo n.º 1
0
        public void ShouldFindSummaryWhenFilterIsNotFound()
        {
            //Arrange
            var domainService = new Mock <IFilterService>();

            domainService.Setup(t => t.Find(1)).Returns <Filter>(null);
            FilterAppService filterAppService = new FilterAppService(domainService.Object, null, null, null);
            //Act
            Action action = () => filterAppService.FindSummary(1);

            //Assert
            Assert.Throws <ExceptionWithCode>(action);
        }
Exemplo n.º 2
0
        public void ShouldFindSummary()
        {
            //Arrange
            var    domainService = new Mock <IFilterService>();
            var    agentService  = new Mock <IAgentService>();
            Filter filter        = MakeFilterEntity(1);

            domainService.Setup(t => t.Find(1)).Returns(filter);
            domainService.Setup(t => t.GetConversationNum(filter)).Returns(1);
            agentService.Setup(t => t.GetDisplayName(1)).Returns("a");
            FilterAppService filterAppService = new FilterAppService(domainService.Object, agentService.Object, null, null);
            //Act
            FilterListDto filterListDto = filterAppService.FindSummary(1);

            //Assert
            Assert.NotNull(filterListDto);
            AssertDtoEqualToEntity(filter, filterListDto);
            Assert.Equal("a", filterListDto.CreatedByName);
            Assert.Equal(1, filterListDto.ConversationNum);
        }