public static PlayingStatus Create(Fixture fixture, Child player) { var newPlayingStatus = new PlayingStatus { Fixture = fixture, Player = player }; player.PlayingStatuses.Add(newPlayingStatus); fixture.PlayingStatuses.Add(newPlayingStatus); return newPlayingStatus; }
public void SchoolHasFixtures() { using (var db = new SchoolDataContext()) { Fixture fixture = new Fixture(); fixture.Kickoff = DateTime.Now; db.Fixtures.Add(fixture); School school = new School(); db.Schools.Add(school); school.Fixtures.Add(fixture); db.SaveChanges(); Assert.That(school.Fixtures.Contains<Fixture>(fixture)); } }
public void ChildHasFixtures() { using (var db = new SchoolDataContext()) { Fixture fixture = new Fixture(); fixture.Kickoff = DateTime.Now; db.Fixtures.Add(fixture); Child child = new Child(); db.Children.Add(child); PlayingStatus playingStatus = PlayingStatus.Create(fixture, child); db.PlayingStatuses.Add(playingStatus); db.SaveChanges(); Assert.That(child.PlayingStatuses.Contains<PlayingStatus>(playingStatus)); } }