public override void ShouldDeleteByEntityReference() { using var context = ContextFixture.Ctx; InitializeDataBase(context); ContextFixture.InitializeWithOneOrder(context); Order orderEntity = new Order(DateTime.Now, null, DateTime.Now, null, null); orderEntity.DefineId(ID); var repository = new OrderRepository(context, MapperFixture.Mapper); repository.Remove(orderEntity); context.Orders.Should().BeEmpty(); }
public override void ShouldUpdate() { using var context = ContextFixture.Ctx; var repository = new OrderRepository(context, MapperFixture.Mapper); InitializeDataBase(context); ContextFixture.InitializeWithOneOrder(context); var order = repository.GetById(ID); var newDeliveryForecast = order.DeliveryForecast.AddDays(10); order.DefineNewDeliveryForecast(newDeliveryForecast); repository.Update(order); var modifiedOrder = repository.GetById(ID); modifiedOrder.DeliveryForecast.Should().Be(newDeliveryForecast); }