/// <inheritdoc /> public void SimulateGame(int winnerId, int loserId) { _validatorService.ValidateTeam(winnerId); _validatorService.ValidateTeam(loserId); double gameCount = _matrixProvider.GetValue(winnerId, loserId); _matrixProvider.SetValue(winnerId, loserId, gameCount - 1); _matrixProvider.SetValue(loserId, winnerId, gameCount - 1); _matrixProvider.SetValue(winnerId, winnerId, _matrixProvider.GetValue(winnerId, winnerId) + 1); _matrixProvider.SetValue(loserId, loserId, _matrixProvider.GetValue(loserId, loserId) + 1); _teams[winnerId].Wins++; _teams[loserId].Losses++; _teams[winnerId].ColleyRating = ComputeColleyRating(_teams[winnerId].Wins, _teams[winnerId].Losses); _teams[loserId].ColleyRating = ComputeColleyRating(_teams[loserId].Wins, _teams[loserId].Losses); }
public void Should_SimluateGame_ForStandardInput() { //arrange int dimensions = 2; int winnerId = 0; int loserId = 1; IMatrixProvider matrixProvider = A.Fake <IMatrixProvider>(); IValidatorService validatorService = A.Fake <IValidatorService>(); A.CallTo(() => matrixProvider.GetDimensions()).Returns(dimensions); IColleyMatrixService colleyMatrixService = new ColleyMatrixService(matrixProvider, validatorService); //act colleyMatrixService.SimulateGame(winnerId, loserId); //assert A.CallTo(() => validatorService.ValidateTeam(winnerId)).MustHaveHappened(); A.CallTo(() => validatorService.ValidateTeam(loserId)).MustHaveHappened(); }