예제 #1
0
        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();
        }
예제 #2
0
 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);
     }
 }