public void ShouldFindFilterByIdWhenFilterIsNotFound() { //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.Find(1); //Assert Assert.Throws <ExceptionWithCode>(action); }
public void ShouldFindFilterById() { //Arrange var domainService = new Mock <IFilterService>(); var agentService = new Mock <IAgentService>(); domainService.Setup(t => t.Find(1)).Returns(MakeFilterEntity(1)); agentService.Setup(t => t.GetDisplayName(1)).Returns("a"); FilterAppService filterAppService = new FilterAppService(domainService.Object, agentService.Object, null, null); //Act FilterDetailsDto filterDetailsDto = filterAppService.Find(1); //Assert Assert.NotNull(filterDetailsDto); AssertDtoEqualToEntity(MakeFilterEntity(1), filterDetailsDto); Assert.Equal("a", filterDetailsDto.CreatedByName); }