예제 #1
0
 internal static ReturnsValidationFixture.IType ExtensionMethod(
     this ReturnsValidationFixture fixture,
     object arg1,
     object arg2
     )
 {
     return(default(ReturnsValidationFixture.IType));
 }
예제 #2
0
        public void Returns_does_not_accept_extension_method_with_wrong_parameter_count()
        {
            Func <object, object, IType> delegateWithWrongParameterCount = new ReturnsValidationFixture().ExtensionMethod;

            var ex = Record.Exception(() =>
            {
                this.setupNoArgs.Returns(delegateWithWrongParameterCount);
            });

            Assert.IsType <ArgumentException>(ex);
        }
예제 #3
0
        public void Returns_accepts_extension_method_with_correct_parameter_count()
        {
            Func <object, object, IType> delegateWithCorrectParameterCount = new ReturnsValidationFixture().ExtensionMethod;

            this.setup.Returns(delegateWithCorrectParameterCount);

            var ex = Record.Exception(() =>
            {
                this.mock.Object.Method(42, 5);
            });

            Assert.Null(ex);
        }
예제 #4
0
        public void Returns_accepts_parameterless_extension_method_even_for_method_having_parameters()
        {
            Func <IType> delegateWithoutParameters = new ReturnsValidationFixture().ExtensionMethodNoArgs;

            this.setup.Returns(delegateWithoutParameters);

            var ex = Record.Exception(() =>
            {
                this.mock.Object.Method(42, 5);
            });

            Assert.Null(ex);
        }
예제 #5
0
 internal static ReturnsValidationFixture.IType ExtensionMethodNoArgs(this ReturnsValidationFixture fixture)
 {
     return(default(ReturnsValidationFixture.IType));
 }