Exemplo n.º 1
0
    public void AddCustomSearchCriterion_PassNotSupportedLambdaExpression_ArgumentExceptionThrown()
    {
        ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

        Assert.Throws <ArgumentException>(
            () => criteria.AddCustomSearchCriterion <SomeClass>(o => o.CollectionComplex.Select(i => i.Nested).Select(i => i.TextNested)));
    }
Exemplo n.º 2
0
    public void AddCustomSearchCriterion_PassNotSupportedProperty_CorrectCriterionReturned()
    {
        ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

        criteria.AddCustomSearchCriterion <SomeClass>(o => o.CollectionComplex);

        Assert.Equal(0, criteria.Count);
    }
Exemplo n.º 3
0
    public void AddCustomSearchCriterion_PassPropertyLambdaExpression_CorrectCriterionAdded()
    {
        ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

        criteria.AddCustomSearchCriterion <SomeClass>(o => o.Text);

        Assert.Equal(1, criteria.Count);
        Assert.Equal("Text", criteria.ElementAt(0).Property);
    }
Exemplo n.º 4
0
    public void AddCustomSearchCriterion_PassNestedPropertyInSimpleCollectionLambdaExpression_CorrectCriterionAdded()
    {
        ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

        criteria.AddCustomSearchCriterion <SomeClass>(o => o.CollectionString);

        Assert.Equal(1, criteria.Count);
        Assert.Equal("CollectionString", criteria.ElementAt(0).Property);
    }
Exemplo n.º 5
0
    public void AddCustomSearchCriterion_PassNestedPropertyInComplexCollectionLambdaExpression_CorrectCriterionAdded()
    {
        ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

        criteria.AddCustomSearchCriterion <SomeClass>(o => o.CollectionComplex.Select(i => i.TextNested));

        Assert.Equal(1, criteria.Count);
        Assert.Equal("CollectionComplex.TextNested", criteria.ElementAt(0).Property);
        Assert.Equal("TextNested with label", criteria.ElementAt(0).LabelText);
    }
Exemplo n.º 6
0
    public void AddCustomSearchCriterion_PassNotSupportedLambdaExpression_CorrectCriterionReturned()
    {
        ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

        Assert.Throws <ArgumentException>(() => criteria.AddCustomSearchCriterion <SomeClass>(o => o));
    }
Exemplo n.º 7
0
        public void AddCustomSearchCriterion_PassNotSupportedLambdaExpression_CorrectCriterionReturned()
        {
            ICollection <AbstractSearch> criteria = new Collection <AbstractSearch>();

            criteria.AddCustomSearchCriterion <SomeClass>(o => o);
        }