예제 #1
0
        public void GetConstraint_BuildUniqueItem_CorrectConstraint()
        {
            //Buiding object used during test
            var sutXml = new StructureXml
            {
                Item = new MeasureGroupsXml
                {
                    ConnectionString = ConnectionStringReader.GetAdomd()
                }
            };

            ((MeasureGroupsXml)sutXml.Item).Perspective = "Perspective";
            sutXml.Item.Caption = "MeasureGroup";

            var ctrXml = new ContainXml
            {
                Items = new List <string> {
                    "Search"
                }
            };

            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var ctr = builder.GetConstraint();

            Assert.That(ctr, Is.InstanceOf <ContainConstraint>());
        }
예제 #2
0
        public void GetConstraint_BuildMultipleItem_CorrectConstraint()
        {
            //Buiding object used during test
            var sutXml = new StructureXml
            {
                Item = new MeasureGroupsXml
                {
                    ConnectionString = ConnectionStringReader.GetAdomd()
                }
            };

            ((MeasureGroupsXml)sutXml.Item).Perspective = "Perspective";

            var ctrXml = new ContainXml();

            ctrXml.Items.Add("Search 1");
            ctrXml.Items.Add("Search 2");
            ctrXml.Items.Add("Search 3");

            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var ctr = builder.GetConstraint();

            Assert.That(ctr, Is.InstanceOf <ContainConstraint>());
        }
예제 #3
0
        public void GetSystemUnderTest_CorrectDimensionTarget_Success()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml();
            var dim    = new DimensionsXml
            {
                ConnectionString = ConnectionStringReader.GetAdomd(),
                Perspective      = "Perspective"
            };

            sutXml.Item = dim;

            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            //Call the method to test
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            //Assertion
            Assert.That(sut, Is.InstanceOf <OlapCommand>());
        }
예제 #4
0
        public void GetSystemUnderTest_CorrectPropertyTarget_Success()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml
            {
                Item = new PropertiesXml
                {
                    ConnectionString = ConnectionStringReader.GetAdomd()
                }
            };

            ((PropertiesXml)sutXml.Item).Perspective = "Perspective";
            ((PropertiesXml)sutXml.Item).Dimension   = "Dimension";
            ((PropertiesXml)sutXml.Item).Hierarchy   = "Hierarchy";
            ((PropertiesXml)sutXml.Item).Level       = "Level";
            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            //Assertion
            Assert.That(sut, Is.InstanceOf <OlapCommand>());
        }
예제 #5
0
        public void GetSystemUnderTest_CorrectMeasureTarget_Success()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml
            {
                Item = new MeasuresXml
                {
                    ConnectionString = ConnectionStringReader.GetAdomd()
                }
            };

            ((MeasuresXml)sutXml.Item).Perspective  = "Perspective";
            ((MeasuresXml)sutXml.Item).MeasureGroup = "MeasureGroup";
            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            //Assertion
            Assert.That(sut, Is.InstanceOf <OlapCommand>());
        }
예제 #6
0
        public void GetSystemUnderTest_ConnectionStringInDefault_CorrectlyInitialized()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml();

            sutXml.Item = new MeasureGroupsXml();
            ((MeasureGroupsXml)sutXml.Item).Perspective = "Perspective";

            sutXml.Default = new DefaultXml()
            {
                ConnectionString = ConnectionStringReader.GetAdomd()
            };

            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            //Call the method to test
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            //Assertion
            Assert.That(sut, Is.InstanceOf <OlapCommand>());
        }
예제 #7
0
        public void GetSystemUnderTest_ConnectionStringInDefault_CorrectlyInitialized()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml();

            sutXml.Item = new MeasureGroupsXml();
            ((MeasureGroupsXml)sutXml.Item).Perspective = "Perspective";

            sutXml.Default = new DefaultXml()
            {
                ConnectionString = "connectionString-default"
            };

            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            //Call the method to test
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            //Assertion
            Assert.That(sut, Is.InstanceOf <MetadataDiscoveryRequest>());
            Assert.That(((MetadataDiscoveryRequest)sut).ConnectionString, Is.EqualTo("connectionString-default"));
        }
예제 #8
0
        public void GetSystemUnderTest_IncorrectHierarchyTargetWithoutPerspective_ThrowException()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml();

            sutXml.Item = new DimensionsXml();
            sutXml.Item.ConnectionString = "ConnectionString";

            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            //Assertion
            Assert.Throws <DiscoveryRequestFactoryException>(delegate { builder.Build(); });
        }
예제 #9
0
        public void GetSystemUnderTest_CorrectPerspectiveTarget_Success()
        {
            //Buiding object used during test
            var ctrXmlStubFactory = new Mock <ContainXml>();
            var ctrXml            = ctrXmlStubFactory.Object;

            var sutXml = new StructureXml();

            sutXml.Item = new PerspectivesXml();
            sutXml.Item.ConnectionString = "ConnectionString";
            var builder = new StructureContainBuilder();

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            //Assertion
            Assert.That(sut, Is.InstanceOf <MetadataDiscoveryRequest>());
        }