示例#1
0
        public void WriteTo_FailingAssertionForBetween_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 = countConstraint.MoreThan(8);
            countConstraint = countConstraint.LessThan(12);

            //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("between").And
                        .StringContaining("8").And
                        .StringContaining("12"));
        }
示例#2
0
        public void Matches_MoreThanWronglySpecified_Validated()
        {
            var members = new MemberResult();

            members.Add("First member");
            members.Add("Second member");

            var countConstraint = new CountConstraint();

            countConstraint.MoreThan(2);

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

            //Test conclusion
            Assert.That(res, Is.False);
        }
示例#3
0
        public void Matches_LessThanAndMoreThanCorrectlySpecified_Validated()
        {
            var members = new MemberResult();

            members.Add("First member");
            members.Add("Second member");

            var countConstraint = new CountConstraint();

            countConstraint.MoreThan(1);
            countConstraint.LessThan(3);

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

            //Test conclusion
            Assert.That(res, Is.True);
        }