public void Return_a_single_result() { _something.Count().Returns(3); Assert.That(_something.Count(), Is.EqualTo(3), "First return"); Assert.That(_something.Count(), Is.EqualTo(3), "Second return"); }
public void FirstIsRunOnce() { var calls = new List <int>(); int callCount = 0; _something.When(x => x.Count()).Do(Callback.First(x => calls.Add(++callCount))); Assert.That(callCount, Is.EqualTo(0), "Should not have been called yet"); _something.Count(); _something.Count(); Assert.AreEqual(new List <int> { 1 }, calls); }
public void ThrowException() { _something.Count().Throws(new Exception()); Assert.Catch <Exception>(() => _something.Count()); }