예제 #1
0
        public void CallingMethodsThatReturnReferenceTypesWillReturnNull()
        {
            // Create a stub.
            ISampleClass stub = CreateStub();

            // Call method that returns reference type.
            stub.MethodThatReturnsObject(1).Should(Be.Null);
        }
예제 #2
0
        public void YouCanCreateStubByCallingMockRepositoryGenerateStub()
        {
            // Create a stub.
            ISampleClass stub = CreateStub();

            // Ensure that its string property is null or empty.
            stub.Property.Should(Be.Null.Or.Empty);

            int    outparam;
            string refparam = "test";

            // Call some methods.
            stub.VoidMethod();
            stub.MethodThatReturnsInteger("test").Should(Be.EqualTo(0));
            stub.MethodThatReturnsObject(0).Should(Be.Null);
            stub.MethodWithOutParameter(out outparam);
            outparam.Should(Be.EqualTo(0));
            stub.MethodWithRefParameter(ref refparam);
            refparam.Should(Be.EqualTo("test"));
        }