public OrdersServiceSteps()
        {
            GetOrdersFixture     = Fixture.CreateMany <DataAccess.Entities.Order>().ToList();
            GetOrderItemsFixture = Fixture.CreateMany <DataAccess.Entities.OrderItem>().ToList();

            var ordersRepoMock = new Mock <IOrdersRepository>();

            ordersRepoMock
            .Setup(x => x.All())
            .Returns(GetOrdersFixture);

            ordersRepoMock
            .Setup(x => x.Save(It.IsAny <DataAccess.Entities.Order>()))
            .Callback <DataAccess.Entities.Order>(order => GetOrdersFixture.Add(order));

            ordersRepoMock
            .Setup(x => x.GetById(It.IsAny <Guid>()))
            .Returns <Guid>(id => GetOrdersFixture.Single(x => x.Id == id));

            ordersRepoMock
            .Setup(x => x.Delete(It.IsAny <Guid>()))
            .Callback <Guid>(id => GetOrdersFixture.Remove(GetOrdersFixture.Single(x => x.Id.HasValue && x.Id.Value == id)));


            var orderItemsRepoMock = new Mock <IOrderItemsRepository>();

            orderItemsRepoMock.Setup(x => x.ForOrderId(It.IsAny <Guid>())).Returns(GetOrderItemsFixture);

            Service = new OrdersService
            {
                OrdersRepository     = ordersRepoMock.Object,
                OrderItemsRepository = orderItemsRepoMock.Object
            };
        }
        public void WhenIPlaceADELETERequestToTheOrdersServiceForAnExistingOrderWithMultipleOrderItems()
        {
            var fixture = GetOrdersFixture.First();

            DeletedOrder = new Orders {
                Id = fixture.Id.GetValueOrDefault().ToString()
            };
            DeleteOrderResponse = Service.Delete(DeletedOrder) as HttpResult;
        }
        public void ThenIShouldGetBackAllTheOrdersCurrentlyInTheDatabase()
        {
            foreach (var order in GetOrdersResponse)
            {
                var fixture = GetOrdersFixture.Single(x => x.Id == order.Id);

                Assert.AreEqual(order.ExpiresAt, fixture.ExpiresAt.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss"));
                Assert.AreEqual(order.Interval, fixture.Interval);
                Assert.AreEqual(order.Owner, fixture.Owner);
                Assert.AreEqual(order.Vendor, fixture.Vendor);
            }
        }
        public void WhenIPlaceADELETERequestToTheOrdersServiceForAnExistingOrderWithOneOrderItem()
        {
            var fixture = GetOrdersFixture.First();

            var orderItemsFixtures = GetOrderItemsFixture.Skip(1).ToList();

            GetOrderItemsFixture.RemoveRange(1, GetOrderItemsFixture.Count - 1);

            DeletedOrder = new Orders {
                Id = fixture.Id.GetValueOrDefault().ToString()
            };
            DeleteOrderResponse = Service.Delete(DeletedOrder) as HttpResult;

            GetOrderItemsFixture.AddRange(orderItemsFixtures);
        }