Ejemplo n.º 1
0
        public void Should_PutPricingStrategy()
        {
            PricingStrategy testPricingStrategy = new PricingStrategy {
                Id = 1
            };

            Mock <IUnitOfWork> mock = new Mock <IUnitOfWork>();

            mock.Setup(f => f.PricingStrategies.Update(testPricingStrategy)).Returns(true);

            PricingStrategiesController controller = new PricingStrategiesController(mock.Object);
            var pricingStrategies = controller.PutPricingStrategy(1, testPricingStrategy);

            Assert.IsType <NoContentResult>(pricingStrategies);
        }
Ejemplo n.º 2
0
        public void ShouldNot_PutPricingStrategy_IdMismatch()
        {
            PricingStrategy testPricingStrategy = new PricingStrategy {
                Id = 1
            };

            Mock <IUnitOfWork> mock = new Mock <IUnitOfWork>();

            mock.Setup(f => f.PricingStrategies.Update(testPricingStrategy)).Returns(true);

            PricingStrategiesController controller = new PricingStrategiesController(mock.Object);
            var pricingStrategy = controller.PutPricingStrategy(2, testPricingStrategy);

            Assert.IsType <BadRequestResult>(pricingStrategy);
        }
Ejemplo n.º 3
0
        public void ShouldNot_PutPricingStrategy_ModelStateError()
        {
            PricingStrategy testPricingStrategy = new PricingStrategy {
                Id = 1
            };

            Mock <IUnitOfWork> mock = new Mock <IUnitOfWork>();

            mock.Setup(f => f.PricingStrategies.Update(testPricingStrategy)).Returns(true);

            PricingStrategiesController controller = new PricingStrategiesController(mock.Object);

            controller.ModelState.AddModelError("TestError", "Error");
            var pricingStrategy = controller.PutPricingStrategy(1, testPricingStrategy);

            Assert.IsType <BadRequestObjectResult>(pricingStrategy);
        }