コード例 #1
0
        public void can_make_dynamic_mocks()
        {
            var mockRepository = new RhinoMockRepositoryProxy();
            object fooMock = mockRepository.DynamicMock(typeof (ITestMocks));

            fooMock.ShouldNotBeNull();
        }
コード例 #2
0
        public void can_put_mock_in_replay_mode()
        {
            var mockRepository = new RhinoMockRepositoryProxy();
            var test = (ITestMocks) mockRepository.DynamicMock(typeof (ITestMocks));

            mockRepository.Replay(test);

            test.Stub(t => t.Answer()).Return("YES");
            test.ShouldNotBeNull();
            test.Answer().ShouldEqual("YES");
        }
コード例 #3
0
        public void can_make_partial_mocks()
        {
            var mockRepository = new RhinoMockRepositoryProxy();
            var testPartials = (TestPartials) mockRepository.PartialMock(typeof (TestPartials), new object[0]);

            testPartials.ShouldNotBeNull();
            mockRepository.Replay(testPartials);
            testPartials.Concrete().ShouldEqual("Concrete");
            testPartials.Virtual().ShouldEqual("Virtual");

            testPartials.Stub(t => t.Virtual()).Return("MOCKED!");
            testPartials.Virtual().ShouldEqual("MOCKED!");
        }