public void GetOrderReturnsNullIfNoOrder()
        {
            Mock <IOrderRepository> orderRepository = new Mock <IOrderRepository>(MockBehavior.Strict);

            var orderService = new ca_service.Services.OrderService(orderRepository.Object, null, null, null);

            int orderId = 42;

            orderRepository.Setup(x => x.Get(orderId)).Returns(() => null);

            var result = orderService.Get(orderId);

            Assert.Null(result);

            orderRepository.VerifyAll();
        }
        public void GetOrderReturnsOrderAndItems()
        {
            Mock <IOrderRepository> orderRepository = new Mock <IOrderRepository>(MockBehavior.Strict);

            Mock <IOrderItemRepository> orderItemRepository = new Mock <IOrderItemRepository>(MockBehavior.Strict);

            var orderService = new ca_service.Services.OrderService(orderRepository.Object, orderItemRepository.Object, null, null);

            int orderId = 42, orderItemId = 84;

            var order = new Order(orderId);

            var orderItem = new OrderItem(orderItemId);

            var orderItems = new List <OrderItem>()
            {
                orderItem
            };

            orderRepository.Setup(x => x.Get(orderId)).Returns(() => order);

            orderItemRepository.Setup(x => x.GetByOrderId(orderId)).Returns(() => orderItems);

            var result = orderService.Get(orderId);

            Assert.NotNull(result);

            Assert.Equal(orderId, result.Id);

            Assert.Equal(orderItems.Count, result.Items.Count);

            Assert.Equal(orderItemId, result.Items.First().Id);

            orderRepository.VerifyAll();
            orderItemRepository.VerifyAll();
        }