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 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)); } }