예제 #1
0
        public VerifyOnly()
        {
            stub = new ThingStub();
            stub.DoSomething();

            fake = A.Fake <IThingy>();
            fake.DoSomething();

            mock = new Mock <IThingy>();
            mock.Object.DoSomething();

            sub = Substitute.For <IThingy>();
            sub.DoSomething();

            rock = Rock.Create <IThingy>();
            rock.Handle(r => r.DoSomething());
            rock.Make().DoSomething();
        }
예제 #2
0
        public CallbackOnly()
        {
            stub = new ThingStub();

            fake = A.Fake <IThingy>();
            A.CallTo(() => fake.DoSomething()).Invokes(f => fakeCalled = true);

            var mockSetup = new Mock <IThingy>();

            mockSetup.Setup(m => m.DoSomething()).Callback(() => mockCalled = true);
            mock = mockSetup.Object;

            sub = Substitute.For <IThingy>();
            sub.When(s => s.DoSomething()).Do(c => subCalled = true);

            var rock = Rock.Create <IThingy>();

            rock.Handle(r => r.DoSomething(), () => rockCalled = true);
            chunk = rock.Make();
        }
예제 #3
0
 public void FakeItEasy() => A.CallTo(() => fake.DoSomething()).MustHaveHappened();
예제 #4
0
 public bool Rocks()
 {
     rockCalled = false;
     chunk.DoSomething();
     return(rockCalled);
 }
예제 #5
0
 public bool NSubstitute()
 {
     subCalled = false;
     sub.DoSomething();
     return(subCalled);
 }
예제 #6
0
 public bool Moq()
 {
     mockCalled = false;
     mock.DoSomething();
     return(mockCalled);
 }
예제 #7
0
 //[Benchmark]
 public bool FakeItEasy()
 {
     fakeCalled = false;
     fake.DoSomething();
     return(fakeCalled);
 }