Exemplo n.º 1
0
        public void withSyntaxeTest2()
        {
            // Prepare mock repository
            MockRepository     mocks             = new MockRepository();
            IDependency        dependency        = mocks.StrictMock <IDependency>();
            IAnotherDependency anotherDependency = mocks.StrictMock <IAnotherDependency>();

            object result = null;

            With.Mocks(mocks).ExpectingInSameOrder(delegate
            {
                // Record expectations which must be met in the exact same order
                Expect.Call(dependency.SomeMethod()).Return(null);
                anotherDependency.SomeOtherMethod();
            })
            .Verify(delegate
            {
                // Replay and validate interaction
                ComponentImplementation underTest = new ComponentImplementation(dependency, anotherDependency);
                result = underTest.TestMethod();
            });

            // Post-interaction assertions
            Assert.IsNull(result);
        }