コード例 #1
0
        public void PredicateTrueIncludeTest()
        {
            var target = new ExpressionMemberSelectionRule(x => true, MemberSelectionMode.Include);
            const MemberSelectionResult expected = MemberSelectionResult.IncludeMember;

            var actual = target.GetSelectionResult(new MemberInformation());

            actual.Should()
            .Be(expected);
        }
コード例 #2
0
        public void PredicateFalseExcludeTest()
        {
            var target = new ExpressionMemberSelectionRule(x => false, MemberSelectionMode.Exclude);
            const MemberSelectionResult expected = MemberSelectionResult.Neutral;

            var actual = target.GetSelectionResult(new MemberInformation());

            actual.Should()
            .Be(expected);
        }
コード例 #3
0
        public void ToStringIncludeTest()
        {
            var          target   = new ExpressionMemberSelectionRule(x => true, MemberSelectionMode.Include, "A", "B");
            const String expected = "[A] = (Include members matching predicate) (B).";

            var actual = target.ToString();

            actual.Should()
            .Be(expected);
        }
コード例 #4
0
        public void CtorTest()
        {
            var expectedName        = RandomValueEx.GetRandomString();
            var expectedDescription = RandomValueEx.GetRandomString();
            var target = new ExpressionMemberSelectionRule(x => true, MemberSelectionMode.Include, expectedName, expectedDescription);

            target.RuleName.Should()
            .Be(expectedName);
            target.RuleDescription.Should()
            .Be(expectedDescription);
        }
コード例 #5
0
        public void CheckMemberInPredicateIsSame()
        {
            var expected             = new MemberInformation();
            MemberInformation actual = null;
            var target = new ExpressionMemberSelectionRule(x =>
            {
                actual = x as MemberInformation;
                return(true);
            },
                                                           MemberSelectionMode.Include);

            var result = target.GetSelectionResult(expected);

            result.Should()
            .Be(MemberSelectionResult.IncludeMember);

            actual.Should()
            .BeSameAs(expected);
        }