public void PredictableRandomNextThrowsOn1And6() { PredictableRandom random = new PredictableRandom(0); Assert.ThrowsException <ArgumentException>(() => random.Next(1, 6)); // TestTools Code UnitTest test = Factory.CreateTest(); TestVariable <PredictableRandom> _random = test.CreateVariable <PredictableRandom>(); test.Arrange(_random, Expr(() => new PredictableRandom(0))); test.Assert.ThrowsExceptionOn <ArgumentException>(Expr(_random, r => r.Next(1, 6))); test.Execute(); }
public void PredictableRandomNextReturns4C() { PredictableRandom random = new PredictableRandom(4); Assert.AreEqual(4, random.Next(1, 6)); // TestTools Code UnitTest test = Factory.CreateTest(); TestVariable <PredictableRandom> _random = test.CreateVariable <PredictableRandom>(); test.Arrange(_random, Expr(() => new PredictableRandom(4))); test.Assert.AreEqual(Const(4), Expr(_random, r => r.Next(1, 6))); test.Execute(); }