Created
July 27, 2017 18:32
-
-
Save dsibinski/933f0a51f858026ce1643686e44996d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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