コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }