Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dsibinski/933f0a51f858026ce1643686e44996d5 to your computer and use it in GitHub Desktop.
Save dsibinski/933f0a51f858026ce1643686e44996d5 to your computer and use it in GitHub Desktop.
[TestMethod]
public void InitializeDatabaseWithDataTest()
{
using (var context = new CarServiceContext(_options))
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
var car1 = new Car()
{
Producer = "Volkswagen",
Model = "Golf IV",
ProductionDate = new DateTime(2009, 01, 01),
IsOnWarranty = false
};
var car2 = new Car()
{
Producer = "Peugeot",
Model = "206",
ProductionDate = new DateTime(2000, 01, 01),
IsOnWarranty = false
};
context.Cars.AddRange(car1, car2);
context.SaveChanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment