Example #1
0
    public void Not_Expression__Throws_PropertyExpressionException()
    {
        // Arrange

        // Act
        var action = () => FluentQueryHelper.AssertPropertyExpression <Test, string>(Rnd.Str, Rnd.Str);

        // Assert
        var ex = Assert.Throws <PropertyExpressionException>(action);

        Assert.Equal($"Expected a property expression but received '{typeof(string)}'.", ex.Message);
    }
Example #2
0
    public void Asserts_Equal()
    {
        // Arrange
        var expected = nameof(Test.Foo);
        Expression <Func <Test, string> > actual = x => x.Foo;

        // Act
        var action = () => FluentQueryHelper.AssertPropertyExpression <Test, string>(expected, actual);

        // Assert
        action();
    }
Example #3
0
    public void Not_Equal__Throws_PropertyExpressionException()
    {
        // Arrange
        var expected = nameof(Test.Bar);
        Expression <Func <Test, string> > actual = x => x.Foo;

        // Act
        var action = () => FluentQueryHelper.AssertPropertyExpression <Test, string>(expected, actual);

        // Assert
        var ex = Assert.Throws <PropertyExpressionException>(action);

        Assert.Equal($"Expected property with name '{expected}' but received '{nameof(Test.Foo)}'.", ex.Message);
    }