コード例 #1
0
ファイル: Has.cs プロジェクト: ywscr/NBi
        public static NBiMember.CountConstraint LessThan(int count)
        {
            var ctr = new NBiMember.CountConstraint();

            ctr.LessThan(count);
            return(ctr);
        }
コード例 #2
0
ファイル: Has.cs プロジェクト: ywscr/NBi
        public new static NBiMember.CountConstraint Exactly(int count)
        {
            var ctr = new NBiMember.CountConstraint();

            ctr.Exactly(count);
            return(ctr);
        }
コード例 #3
0
        public void Matches_ExactlyWronglySpecified_Validated()
        {
            var members = new MemberResult();
            members.Add("First member");
            members.Add("Second member");

            var countConstraint = new CountConstraint();
            countConstraint.Exactly(1);

            //Method under test
            var res = countConstraint.Matches(members);

            //Test conclusion
            Assert.That(res, Is.False);
        }
コード例 #4
0
        public void Matches_LessThanAndMoreThanWronglySpecifiedForLessThan_Validated()
        {
            var members = new MemberResult();
            members.Add("First member");
            members.Add("Second member");

            var countConstraint = new CountConstraint();
            countConstraint.MoreThan(1);
            countConstraint.LessThan(2);

            //Method under test
            var res = countConstraint.Matches(members);

            //Test conclusion
            Assert.That(res, Is.False);
        }
コード例 #5
0
        public void WriteTo_FailingAssertionForMoreThan_TextContainsFewKeyInfo()
        {
            var cmd = new DiscoveryRequestFactory().Build(
                "connectionString",
                "member-caption",
                "perspective-name",
                "dimension-caption",
                "hierarchy-caption",
                null);

            var memberStub = new Mock<NBi.Core.Analysis.Member.Member>();
            var member1 = memberStub.Object;
            var member2 = memberStub.Object;
            var members = new MemberResult();
            members.Add(member1);
            members.Add(member2);

            var meStub = new Mock<MembersAdomdEngine>();
            meStub.Setup(engine => engine.GetMembers(cmd))
                .Returns(members);
            var me = meStub.Object;

            var countConstraint = new CountConstraint() { MembersEngine = me };
            countConstraint.MoreThan(10);

            //Method under test
            string assertionText = null;
            try
            {
                Assert.That(cmd, countConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Assert.That(assertionText, Is.StringContaining("perspective-name").And
                                            .StringContaining("dimension-caption").And
                                            .StringContaining("hierarchy-caption").And
                                            .StringContaining("member-caption").And
                                            .StringContaining("children").And
                                            .StringContaining("more than").And
                                            .StringContaining("10"));
        }
コード例 #6
0
        public void Matches_LessThanCorrectlySpecified_Validated()
        {
            var members = new MemberResult();
            members.Add("First member");
            members.Add("Second member");

            var countConstraint = new CountConstraint();
            countConstraint.LessThan(3);

            //Method under test
            var res = countConstraint.Matches(members);

            //Test conclusion
            Assert.That(res, Is.True);
        }
コード例 #7
0
ファイル: Has.cs プロジェクト: Waltervondehans/NBi
 public static NBiMember.CountConstraint MoreThan(int count)
 {
     var ctr = new NBiMember.CountConstraint();
     ctr.MoreThan(count);
     return ctr;
 }
コード例 #8
0
ファイル: Has.cs プロジェクト: Waltervondehans/NBi
 public static new NBiMember.CountConstraint Exactly(int count)
 {
     var ctr = new NBiMember.CountConstraint();
     ctr.Exactly(count);
     return ctr;
 }