Example #1
0
File: Has.cs Project: ywscr/NBi
        public static NBiMember.CountConstraint LessThan(int count)
        {
            var ctr = new NBiMember.CountConstraint();

            ctr.LessThan(count);
            return(ctr);
        }
Example #2
0
File: Has.cs Project: ywscr/NBi
        public new static NBiMember.CountConstraint Exactly(int count)
        {
            var ctr = new NBiMember.CountConstraint();

            ctr.Exactly(count);
            return(ctr);
        }
        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);
        }
        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);
        }
        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"));
        }
        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);
        }
Example #7
0
 public static NBiMember.CountConstraint MoreThan(int count)
 {
     var ctr = new NBiMember.CountConstraint();
     ctr.MoreThan(count);
     return ctr;
 }
Example #8
0
 public static new NBiMember.CountConstraint Exactly(int count)
 {
     var ctr = new NBiMember.CountConstraint();
     ctr.Exactly(count);
     return ctr;
 }