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); }
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); }
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); }
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); }
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); }