public void Can_verifyall() { var mocked = mocker.Create <ClassWithMultipleDependencies>(); mocker.GetMock <IDependency>().Setup(m => m.Something()); mocker.GetMock <IOtherDependency>().Setup(m => m.SomethingElse()); mocked.ConditionallyUseDepedencies(true, true); mocker.VerifyAll(); }
public void AutoMoqerWithExplicitVerificationCallThrowsExceptionForNonCalledMethods() { try { var automoqer = new AutoMoqer <CommonService>().BuildWithExplicitVerification(); automoqer .Param <ISimpleService>() .Setup(f => f.GetBool()) .Returns(true); automoqer.VerifyAll(); } catch (System.Reflection.TargetInvocationException exc) { // Moq.MockVerificationException is internal. Assert.AreEqual("Moq.MockVerificationException", exc.InnerException.GetType().FullName); } }