public void ShouldCalculateCorretEloValues() { var player0 = Mock.Of <IEloRating>(); player0.FighterId = new Guid("152D68CE-6D84-4400-87B9-93B40A4576E6"); player0.PreviousElo = 1500; player0.CurrentElo = 1500; var player1 = Mock.Of <IEloRating>(); player1.FighterId = new Guid("04A0BFCE-38BD-4C4D-B31B-52E9EF0567A1"); player1.PreviousElo = 1500; player1.CurrentElo = 1500; var player2 = Mock.Of <IEloRating>(); player2.FighterId = new Guid("26A31E83-1C14-48C1-8D10-E98D85B1E27C"); player2.PreviousElo = 1500; player2.CurrentElo = 1500; var ratings = new IEloRating[] { player0, player1, player2, }; var positions = new EloPosition[] { new EloPosition() { Id = player0.FighterId, Points = 200, }, new EloPosition() { Id = player1.FighterId, Points = 300, }, new EloPosition() { Id = player2.FighterId, Points = 100, } }; eloCalculator.Calculate(ratings, positions); Assert.Equal(1508, player1.CurrentElo); Assert.Equal(1500, player0.CurrentElo); Assert.Equal(1492, player2.CurrentElo); Assert.Equal(1500, player0.PreviousElo); Assert.Equal(1500, player1.PreviousElo); Assert.Equal(1500, player2.PreviousElo); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { var path = Path.Combine(Environment.CurrentDirectory, "DeckMatchups.xlsx"); var reader = new WorkbookReader(path); var matchups = reader.GetAllMatchups(); var calc = new EloCalculator(); calc.Calculate(matchups); var decklist = new List <Deck>(); decklist.AddRange(matchups.Select(m => m.DeckA).Distinct()); decklist.AddRange(matchups.Where(m => !decklist.Contains(m.DeckB)).Select(m => m.DeckB).Distinct()); _allDecks = decklist; Decks = _allDecks; Filter = new DeckFilter(); Filter.FilterChangedEvent += OnFilterChanged; }