Esempio n. 1
0
        public void ShouldDeleteWhenFilterIsNotFound()
        {
            //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.Delete(1);

            //Assert
            Assert.Throws <ExceptionWithCode>(action);
        }
Esempio n. 2
0
        public void ShouldDelete()
        {
            //Arrange
            var    domainService       = new Mock <IFilterService>();
            var    notificationManager = new Mock <INotificationManager>();
            Filter filter = MakeFilterEntity(1);

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

            //Act
            filterAppService.Delete(1);
            //Assert
            domainService.Verify(t => t.Delete(It.Is <int>(r => r == 1)));
            notificationManager.Verify(t => t.NotifyDeleteFilter(It.Is <int>(r => r == 10000), It.Is <int>(r => r == 1)));
        }