public async Task ShouldUpdate()
        {
            //Arrange
            var domainService       = new Mock <IFilterService>();
            var unitOfWorkManager   = new Mock <IUnitOfWorkManager>();
            var notificationManager = new Mock <INotificationManager>();
            var agentService        = new Mock <IAgentService>();

            unitOfWorkManager.Setup(t => t.Current.SaveChanges());
            Filter filter = MakeFilterEntity(1);

            domainService.Setup(t => t.Find(1)).Returns(filter);
            FilterAppService filterAppService = new FilterAppService(domainService.Object, agentService.Object, notificationManager.Object, null);

            filterAppService.UnitOfWorkManager = unitOfWorkManager.Object;
            //Act
            FilterDetailsDto filterDetailsDto = await filterAppService.Update(1, MakeFilterUpdateDto());

            //Assert
            domainService.Verify(t => t.DeleteConditons(It.Is <Filter>(r => r.Id == 1)));
            domainService.Verify(t => t.UpdateFilter(It.Is <Filter>(r => r.Id == 1), It.Is <FilterCondition[]>(r => r.FirstOrDefault().FieldId == 1)));
            notificationManager.Verify(t => t.NotifyUpdateFilter(It.Is <int>(r => r == 10000), It.Is <int>(r => r == 1)));
            agentService.Verify(t => t.FillCreatedByName(It.Is <List <FilterDetailsDto> >(r => r.FirstOrDefault().CreatedBy == 1)));
            AssertDtoEqualToEntity(filter, filterDetailsDto);
            AssertDtoEqualToEntity(filter, MakeFilterCreateDto());
        }
        public void ShouldUpdateWhenUpdateFilterIsNotFound()
        {
            //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.Update(1, MakeFilterUpdateDto());

            //Assert
            Assert.Throws <ExceptionWithCode>(action);
        }