public void InsertMultipleRaceDaysTest() { using (var context = new HorseSenseContext(GetHorseSenseContextOptionForMethod())) { var raceday = new RaceDay() { Track = "TestTrack", Date = "20180102" }; var racedayNewDate = new RaceDay() { Track = "TestTrack", Date = "20180103" }; var racedayNewTrack = new RaceDay() { Track = "AnotherTrack", Date = "20180102" }; DrfParser.ParseLine(context, raceday); DrfParser.ParseLine(context, racedayNewDate); DrfParser.ParseLine(context, racedayNewTrack); Assert.AreEqual(3, context.RaceDays.Count(), "Incorrect number of raceDays"); Assert.IsNotNull(context.RaceDays.FirstOrDefault(r => r.Track == "TestTrack" && r.Date == "20180102")); Assert.AreEqual(1, context.RaceDays.Where(r => r.Track == "TestTrack" && r.Date == "20180103").Count()); Assert.AreEqual(1, context.RaceDays.Where(r => r.Track == "AnotherTrack" && r.Date == "20180102").Count()); } }
public void DuplicateInsertRaceDayTest() { using (var context = new HorseSenseContext(GetHorseSenseContextOptionForMethod())) { var raceday = new RaceDay() { Track = "TestTrack", Date = "20180102" }; DrfParser.ParseLine(context, raceday); DrfParser.ParseLine(context, raceday); Assert.AreEqual(1, context.RaceDays.Count()); Assert.AreEqual("TestTrack", context.RaceDays.Single().Track); Assert.AreEqual("20180102", context.RaceDays.Single().Date); } }