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();
        }
Beispiel #3
0
        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);
        }
Beispiel #5
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();
        }
Beispiel #6
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();
        }
Beispiel #7
0
        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();
		}
Beispiel #9
0
 public Program(IThingy thingy)
 {
     _thingy = thingy;
 }
Beispiel #10
0
 [SetUp] public void SetUp()
 {
     mock   = new Mock("Test Mock");
     cg     = new ClassGenerator(typeof(IThingy), mock);
     thingy = (IThingy)cg.Generate();
 }