public Contracts.Order UpdateOrder(Contracts.Order order)
        {
            var mappedDTOOrder = Mapper.Map <DTOs.Order>(order);
            var updatedOrder   = InventoryAccessor.UpdateOrder(mappedDTOOrder);

            return(Mapper.Map <Contracts.Order>(updatedOrder));
        }
        public void InventoryAccessor_UpdateOrder_ForExistingOrder_ShouldSucceed()
        {
            // Arrange
            using var inventoryDbContext = InventoryDbContext;

            try
            {
                // Insert seed data into the database using one instance of the context
                AddCustomers(inventoryDbContext);
                AddOrders(inventoryDbContext);

                var order = new DTOs.Order
                {
                    Id               = 1,
                    Name             = "Hashbrowns",
                    DateCreated      = DateTime.Now,
                    DateLastModified = DateTime.Now,
                    CustomerId       = 1
                };

                var inventoryAccessor = new InventoryAccessor(inventoryDbContext, Mapper);

                // Act
                var orderUpdated = inventoryAccessor.UpdateOrder(order);

                // Assert
                Assert.NotNull(orderUpdated);
                Assert.Equal(order.Name, orderUpdated.Name);
            }
            finally
            {
                inventoryDbContext.ChangeTracker
                .Entries()
                .ToList()
                .ForEach(e => e.State = EntityState.Detached);
                inventoryDbContext.Database.EnsureDeleted();
            }
        }