public void ReturnNoContentStatusCode()
        {
            // Arrange
            string customerId = "ALFKI";
            var    service    = new Mock <ICustomerService>();
            CustomersController controller = new CustomersController(service.Object);

            // Act
            var result = controller.CustomerOrders(customerId) as StatusCodeResult;

            // Assert
            Assert.AreEqual(HttpStatusCode.NoContent, result.StatusCode);
        }
        public void NotBeNull()
        {
            // Arrange
            var service = new Mock <ICustomerService>();
            CustomersController controller = new CustomersController(service.Object);
            string customerId = "ALFKI";

            // Act
            IHttpActionResult result = controller.CustomerOrders(customerId) as IHttpActionResult;

            // Assert
            Assert.IsNotNull(result);
        }
        public void ReturnOkNegotiatedContentResult()
        {
            // Arrange
            string customerId         = "ALFKI";
            var    ordersByCustomerId = new List <OrderModel>()
            {
                new OrderModel()
                {
                    ProductsCount             = 50,
                    Total                     = 300,
                    IsProductInProduction     = true,
                    IsThereEnoughUnitsInStock = false,
                },
                new OrderModel()
                {
                    ProductsCount             = 30,
                    Total                     = 20,
                    IsProductInProduction     = false,
                    IsThereEnoughUnitsInStock = true,
                }
            };
            var service = new Mock <ICustomerService>();

            service.Setup(x => x.GetOrdersByCustomerId(customerId)).Returns(ordersByCustomerId);
            CustomersController controller = new CustomersController(service.Object);

            // Act
            var result = controller.CustomerOrders(customerId) as OkNegotiatedContentResult <List <OrderModel> >;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(ordersByCustomerId[0].IsProductInProduction, result.Content[0].IsProductInProduction);
            Assert.AreEqual(ordersByCustomerId[0].IsThereEnoughUnitsInStock, result.Content[0].IsThereEnoughUnitsInStock);
            Assert.AreEqual(ordersByCustomerId[0].ProductsCount, result.Content[0].ProductsCount);
            Assert.AreEqual(ordersByCustomerId[0].Total, result.Content[0].Total);
            Assert.AreEqual(ordersByCustomerId[1].IsProductInProduction, result.Content[1].IsProductInProduction);
            Assert.AreEqual(ordersByCustomerId[1].IsThereEnoughUnitsInStock, result.Content[1].IsThereEnoughUnitsInStock);
            Assert.AreEqual(ordersByCustomerId[1].ProductsCount, result.Content[1].ProductsCount);
            Assert.AreEqual(ordersByCustomerId[1].Total, result.Content[1].Total);
        }