public void Should_throw_when_expression_is_not_method_or_property_getter_or_invocation()
        {
            // Arrange
            var instance = new TypeWithPublicField();
            var call     = Call(() => instance.PublicField);

            // Act

            // Assert
            Assert.That(
                () => this.parser.Parse(call),
                Throws.ArgumentException.With.Message.EqualTo("The specified expression is not a method call or property getter."));
        }
예제 #2
0
        public void Should_throw_when_expression_is_not_method_or_property_getter_or_invocation()
        {
            // Arrange
            var instance = new TypeWithPublicField();
            var call     = Call(() => instance.PublicField);

            // Act
            var exception = Record.Exception(() => this.parser.Parse(call));

            // Assert
            exception.Should()
            .BeAnExceptionOfType <ArgumentException>()
            .WithMessage("The specified expression is not a method call or property getter.");
        }
예제 #3
0
        public void GetFakeObjectCallIsMadeOn_should_thrown_when_object_call_is_made_on_is_not_faked()
        {
            //Arrange
            var notFaked = new TypeWithPublicField();

            Expression <Func <int> > callSpecification = () => notFaked.Foo;

            var manager = this.CreateManager();

            // Act

            // Assert
            Assert.Throws <ArgumentException>(() =>
                                              manager.GetFakeObjectCallIsMadeOn(callSpecification));
        }