internal Game CreateGame(int randomGuessNo = 0) { var randomGenerator = new RandomGeneratorStub(randomGuessNo); _game = new Game(randomGenerator); return(_game); }
internal GameService CreateGameService() { var randomGeneratorStub = new RandomGeneratorStub(10); _unitOfWork = new UnitOfWorkStub(); var gameService = new GameService(_gameRepository, randomGeneratorStub, _unitOfWork, _userRepository); return(gameService); }
public void InspectMinimumLimits() { double value = 0; IRandomGenerator randomGenerator = new RandomGeneratorStub(0.01); var sampleData = new SampleDataGenerator(5, 10, randomGenerator); for (var i = 0; i < 100; i++) { value = Math.Round(sampleData.GetNextValue(), 2); Assert.True(value >= 5); } }
public GameEngineTests() { _timeStub = new TimeStub(); _playerManagerStub = new PlayerManagerStub(); _shotManagerStub = new ShotManagerStub(); _randomGeneratorStub = new RandomGeneratorStub(); _gameEngine = new GameEngine(NullLoggerFactory.Instance, _timeStub, _randomGeneratorStub) { PlayerManager = _playerManagerStub, ShotManager = _shotManagerStub }; }
public void InspectMaximumLimits() { double value = 0; IRandomGenerator randomGenerator = new RandomGeneratorStub(0.99); var sampleData = new SampleDataGenerator(5, 10, randomGenerator); for (int i = 0; i < 100; i++) { value = Math.Round(sampleData.GetNextValue(), 2); Assert.LessOrEqual(value, 10); } }
public void ChangingSetpointWorksRepeatably() { // this is to check for a bug that manifested when // ShiftSubsequentData() was called several times with // various values IRandomGenerator randomGenerator = new RandomGeneratorStub(0.95); var sampleData = new SampleDataGenerator(10, 20, randomGenerator); sampleData.GetNextValue(); sampleData.ShiftSubsequentData(200); sampleData.GetNextValue(); sampleData.ShiftSubsequentData(2000); // this one will just be 2000 sampleData.GetNextValue(); // this one will likely be different var result1 = sampleData.GetNextValue(); Assert.True(result1 >= 1995); Assert.True(result1 <= 2005); sampleData.ShiftSubsequentData(-2000); // this one will just be -2000 sampleData.GetNextValue(); // this one will likely be different var result2 = sampleData.GetNextValue(); Assert.True(result2 >= -2005); Assert.True(result2 <= -1995); }
public void SetUp() { generator = new RandomGeneratorStub(); }