public EmptyMethodOnly() { stub = new ThingStub(); fake = A.Fake <IThingy>(); mock = new Mock <IThingy>().Object; sub = Substitute.For <IThingy>(); chunk = Rock.Make <IThingy>(); }
[Test] public void CallMethodWithWeirdObjectReturn() { IThingy t = thingy; mock.ExpectAndReturn("AThingy", t); IThingy result = thingy.AThingy(); Assertion.AssertEquals(thingy, result); mock.Verify(); }
private static Program Create() { IThingy thingy = null; #if USE_ALTERNATES thingy = new thingy.alternate.AlternateThingy(); #else thingy = new thingy.http.HttpThingy(); #endif return(new Program(thingy)); }
[Test] public void CreateGenericProxy() { InvocationHandlerImpl handler = new InvocationHandlerImpl(); ClassGenerator cg = new ClassGenerator(typeof(IThingy), handler); IThingy thingy = (IThingy)cg.Generate(); handler.expectedMethodName = "NoArgs"; thingy.NoArgs(); Assertion.Assert("Should have been called ", handler.wasCalled); }
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(); }
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(); }
public ReturnOnly() { stub = new ThingStub(); fake = A.Fake <IThingy>(); A.CallTo(() => fake.One()).Returns(1); var mockSetup = new Mock <IThingy>(); mockSetup.Setup(m => m.One()).Returns(1); mock = mockSetup.Object; sub = Substitute.For <IThingy>(); sub.One().Returns(1); var rock = Rock.Create <IThingy>(); rock.Handle(r => r.One()).Returns(1); chunk = rock.Make(); }
[SetUp] public void SetUp() { mock = new Mock("Test Mock"); cg = new ClassGenerator(typeof(IThingy), mock); thingy = (IThingy)cg.Generate(); }
public Program(IThingy thingy) { _thingy = thingy; }