public void TestInGameTimeSinceLastThrowWithoutSaving( [ValueSource(nameof(Seconds))] double secondsInGame ) { FortuneFountainSaveData fortuneFountainSaveData = FortuneFountainSaveData.NewSaveFile(nameof(TestInGameTimeSinceLastThrowWithoutSaving)); var inGameTime = TimeSpan.FromSeconds(secondsInGame); fortuneFountainSaveData.Hand.LastThrowTime = FrameTime.Now - inGameTime; Assert.That(fortuneFountainSaveData.InGameTimeSinceLastThrow, Is.InRange(inGameTime.Multiply(0.999), inGameTime.Multiply(1.001))); }
public void TestGenerateInterval( [ValueSource(nameof(rates))] double rateInItemsPerSecond ) { var saveData = new FortuneFountainSaveData(nameof(TestGenerateInterval)); var pv = new PlayerValuable(saveData, ValuableType.Coin) { Rate = rateInItemsPerSecond }; Assert.That(TimeSpan.FromSeconds(1).Divide(pv.GenerateInterval), Is.InRange(Math.Floor(rateInItemsPerSecond), rateInItemsPerSecond * 1.00001)); Assert.That(pv.GenerateInterval, Is.EqualTo(TimeSpan.FromTicks((long)(TimeSpan.TicksPerSecond / rateInItemsPerSecond)))); }