public void WhenShopDoesNotExistsThenReturnNotSuccessfull() { var shopRepository = new Mock <IShopRepository>(); shopRepository.Setup(r => r.GetShopById(It.IsAny <Guid>())).Returns((Shop)null); var shopConfigurationService = new ShopConfigurationService(shopRepository.Object); ServiceActionResult actionResult = shopConfigurationService.ShopActivation(It.IsAny <Guid>(), It.IsAny <bool>()); actionResult.Status.Should().Be(ActionStatus.NotSuccessfull); }
public void WhenShopExistsThenUpdateShopAndReturnSuccessfull() { var shopRepository = new Mock <IShopRepository>(); shopRepository.Setup(r => r.GetShopById(new Guid("{4BA29681-3FA1-431E-8C98-12E3B952BA25}"))).Returns(new Shop()); var shopConfigurationService = new ShopConfigurationService(shopRepository.Object); ServiceActionResult actionResult = shopConfigurationService.ShopActivation(new Guid("{4BA29681-3FA1-431E-8C98-12E3B952BA25}"), It.IsAny <bool>()); actionResult.Should().Be(ServiceActionResult.Successfull); }
public void WhenExceptionCatchedThenReturnWithExceptionStatus() { var shopRepository = new Mock <IShopRepository>(); shopRepository.Setup(r => r.GetShopById(new Guid("{4BA29681-3FA1-431E-8C98-12E3B952BA25}"))).Throws <Exception>(); var shopConfigurationService = new ShopConfigurationService(shopRepository.Object); ServiceActionResult actionResult = shopConfigurationService.ShopActivation(new Guid("{4BA29681-3FA1-431E-8C98-12E3B952BA25}"), It.IsAny <bool>()); actionResult.Status.Should().Be(ActionStatus.WithException); }