public void OnCreation_CalculatesNumberOfLosses() { // Arrange MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); // Act int actual = vm.TotalLost; // Assert Assert.AreEqual(2, actual); }
public void OnCreation_CalculatesTheNumberOfGamesPlayedWithARecordedMap() { // Arrange MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); // Act int actual = vm.TotalWithMaps; // Assert Assert.AreEqual(_defaultProfile.MatchHistory.Count() - 1, actual); }
public void OnCreation_CalculatesTotalPlayed() { // Arrange MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); // Act int actual = vm.TotalPlayed; // Assert Assert.AreEqual(_defaultProfile.MatchHistory.Count(), actual); }
public void OnNewMatchRecord_RecalculatesTotalPlayed() { // Arrange MatchRecord newRecord = MatchRecordFaker.CreateRecord(); MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); // Act NewMatchRecord(newRecord); // Assert Assert.AreEqual(_profileManager.ActiveProfile.MatchHistory.Count(), vm.TotalPlayed); }
public void OnNewMatchRecord_RecalculatesTotalLost() { // Arrange MatchRecord newRecord = MatchRecordFaker.CreateRecord(result: MatchResult.LOSE); MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); int lost = vm.TotalLost; // Act NewMatchRecord(newRecord); // Assert Assert.AreEqual(lost + 1, vm.TotalLost); }
public void OnNewMatchRecord_RecalculatesTotalDrawn() { // Arrange MatchRecord newRecord = MatchRecordFaker.CreateRecord(result: MatchResult.DRAW); MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); int drawn = vm.TotalDrawn; // Act NewMatchRecord(newRecord); // Assert Assert.AreEqual(drawn + 1, vm.TotalDrawn); }
public void OnProfileChange_RecalculatesStatistics_ForNewActiveProfile() { // Arrange MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); // Act _profileManager.OpenProfile(_alternateProfile.Name); // Assert Assert.AreEqual(_alternateProfile.MatchHistory.Count(), vm.TotalPlayed); Assert.AreEqual(_alternateProfile.MatchHistory.Wins(), vm.TotalWon); Assert.AreEqual(_alternateProfile.MatchHistory.Draws(), vm.TotalDrawn); Assert.AreEqual(_alternateProfile.MatchHistory.Losses(), vm.TotalLost); Assert.AreEqual(_alternateProfile.MatchHistory.Count(p => p.Map != "N/A"), vm.TotalWithMaps); }
public void OnCreation_CalculatesStatisticsPerMap_ForAllMaps_ExceptNA_WithCorrectValues() { // Arrange MapWinRatesViewModel vm = new MapWinRatesViewModel(_profileManager); // Act IEnumerable <MapStatistics> stats = vm.Stats; // Assert Assert.AreEqual(Maps.All.Length - 1, stats.Count()); MapStatistics matchOneStats = stats.First(s => s.Map == Maps.All.ElementAt(1)); Assert.AreEqual(2, matchOneStats.TotalWon); Assert.AreEqual(0, matchOneStats.TotalLost); Assert.AreEqual(0, matchOneStats.TotalDrawn); }