Exemplo n.º 1
0
        public void WriteTo_FailingAssertionForSpecific_TextContainsFewKeyInfo()
        {
            var cmd = new DiscoveryRequestFactory().Build(
                "connectionString",
                "member-caption",
                "perspective-name",
                "dimension-caption",
                "hierarchy-caption",
                null);

            var member1Stub = new Mock <NBi.Core.Analysis.Member.Member>();
            var member1     = member1Stub.Object;

            member1.Caption = "A";
            var member2Stub = new Mock <NBi.Core.Analysis.Member.Member>();
            var member2     = member2Stub.Object;

            member2.Caption = "B";
            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 orderedConstraint = new OrderedConstraint()
            {
                MembersEngine = me
            };

            orderedConstraint.Specific(new List <object>()
            {
                "B", "A"
            });

            //var assertionText = orderedConstraint.CreatePredicate();
            //Method under test
            string assertionText = null;

            try
            {
                Assert.That(cmd, orderedConstraint);
            }
            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("specifically"));
        }
Exemplo n.º 2
0
        public void Matches_SpecificNotCorrectlyOrdered_Failed()
        {
            var members = new MemberResult();

            members.Add("Leopold");
            members.Add("Baudoin");
            members.Add("Albert");

            var ordspec = new List <object>();

            ordspec.Add("Leopold");
            ordspec.Add("Albert");
            ordspec.Add("Baudoin");

            var orderedConstraint = new OrderedConstraint();

            orderedConstraint = orderedConstraint.Specific(ordspec);

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

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