public void EditsMatchesScoresAndReturnsUpdatedGroupState() { InitializeRepository(); HTEC.ScoreUpdate su = new HTEC.ScoreUpdate() { MatchId = 100, UpdatedScore = "5:0" }; IEnumerable <HTEC.Group> groups = repository.EditMatches(new List <HTEC.ScoreUpdate>() { su }); Assert.NotNull(groups); Assert.True(groups.Count() == 8); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.A) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.A).Standing.Count == 2); Assert.Equal("Inter", groups.FirstOrDefault(x => x.Name == GroupName.A).Standing[0].Team); Assert.Equal(5, groups.FirstOrDefault(x => x.Name == GroupName.A).Standing[0].Goals); Assert.Equal("Milan", groups.FirstOrDefault(x => x.Name == GroupName.A).Standing[1].Team); Assert.Equal(0, groups.FirstOrDefault(x => x.Name == GroupName.A).Standing[1].Goals); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.A).Standing.Count == 2); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.B) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.C) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.D) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.E) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.F) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.G) != null); Assert.True(groups.FirstOrDefault(x => x.Name == GroupName.H) != null); }
public void ThrowsExceptionWhenNoValidScoreUpdatesAreSent() { HTEC.ScoreUpdate su = new HTEC.ScoreUpdate() { MatchId = 100, UpdatedScore = "!:2" }; Assert.Throws <ArgumentException>(() => { repository.EditMatches(new List <HTEC.ScoreUpdate>() { su }); }); }