public void InquireFurtherAnalysisService_Tabular_ReturnCorrectServerMode()
        {
            var connectionString = ConnectionStringReader.GetAdomdTabular();

            var provider   = new FakeStructureDiscoveryFactoryProvider();
            var serverMode = provider.InquireFurtherAnalysisService(connectionString);

            Assert.That(serverMode, Is.EqualTo("tabular"));
        }
        public void Execute_TabularSchemas_FourElements()
        {
            var conn    = new AdomdConnection(ConnectionStringReader.GetAdomdTabular());
            var factory = new TabularStructureDiscoveryFactory(conn);
            var cmd     = factory.Instantiate(Target.Perspectives, TargetType.Object,
                                              new CaptionFilter[] {
            });

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(4));
        }
        public void Execute_OnSchemaNamedInternetOperation_ListStructureContainingTenTables()
        {
            var conn    = new AdomdConnection(ConnectionStringReader.GetAdomdTabular());
            var factory = new TabularStructureDiscoveryFactory(conn);
            var cmd     = factory.Instantiate(Target.Tables, TargetType.Object,
                                              new CaptionFilter[] {
                new CaptionFilter(Target.Perspectives, "Internet Operation")
            });

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(15));
        }
        public void Execute_TabularMeasureGroupsForFinance_ThreeElements()
        {
            var conn    = new AdomdConnection(ConnectionStringReader.GetAdomdTabular());
            var factory = new TabularStructureDiscoveryFactory(conn);
            var cmd     = factory.Instantiate(Target.MeasureGroups, TargetType.Object,
                                              new CaptionFilter[] {
                new CaptionFilter(Target.Perspectives, "Internet Operation"),
            });

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(3));
        }
Exemple #5
0
        public void Execute_OnPerspectiveNamedInternetOperation_ListStructureContainingTenTables()
        {
            var request = new MetadataDiscoveryRequest();

            request.SpecifyFilter(new CaptionFilter("Internet Operation", DiscoveryTarget.Perspectives));

            var disco = new TableDiscoveryCommand(ConnectionStringReader.GetAdomdTabular());

            disco.Filters = request.GetAllFilters();

            var structs = disco.Execute();

            Assert.That(structs.Count(), Is.EqualTo(10));
        }
        public void Execute_TabularDateDimensionWithHeighTeenHierarchies_ListStructureContainingSevenTeenElements()
        {
            var conn    = new AdomdConnection(ConnectionStringReader.GetAdomdTabular());
            var factory = new TabularStructureDiscoveryFactory(conn);
            var cmd     = factory.Instantiate(Target.Hierarchies, TargetType.Object,
                                              new CaptionFilter[] {
                new CaptionFilter(Target.Perspectives, "Internet Operation"),
                new CaptionFilter(Target.Dimensions, "Date")
            });

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(17));
        }
        public void Execute_TabularColumnsForInternetSales_TwentySevenElements()
        {
            var conn    = new AdomdConnection(ConnectionStringReader.GetAdomdTabular());
            var factory = new TabularStructureDiscoveryFactory(conn);
            var cmd     = factory.Instantiate(Target.Columns, TargetType.Object,
                                              new CaptionFilter[] {
                new CaptionFilter(Target.Perspectives, "Internet Operation"),
                new CaptionFilter(Target.Tables, "Internet Sales"),
            });

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(27));
        }
        public void Execute_ValidDax_GetResult()
        {
            var query = "EVALUATE CALCULATETABLE(VALUES('Product Subcategory'[Product Subcategory Name]),'Product Category'[Product Category Name] = \"Bikes\")";
            var cmd   = new AdomdCommand(query, new AdomdConnection(ConnectionStringReader.GetAdomdTabular()));
            var qe    = new AdomdExecutionEngine(cmd.Connection, cmd);
            var ds    = qe.Execute();

            Assert.IsInstanceOf <string>(ds.Tables[0].Rows[0][0]);
            Assert.AreEqual((string)ds.Tables[0].Rows[0][0], "Mountain Bikes");
            Assert.AreEqual((string)ds.Tables[0].Rows[1][0], "Road Bikes");
            Assert.AreEqual((string)ds.Tables[0].Rows[2][0], "Touring Bikes");

            Assert.AreEqual(ds.Tables[0].Rows.Count, 3);
            Assert.AreEqual(ds.Tables[0].Columns.Count, 1);
        }
        public void Execute_TabularMonthLevelWithTwoProperties_ListStructureContainingNoElement()
        {
            var conn    = new AdomdConnection(ConnectionStringReader.GetAdomdTabular());
            var factory = new TabularStructureDiscoveryFactory(conn);
            var cmd     = factory.Instantiate(Target.Properties, TargetType.Object,
                                              new CaptionFilter[] {
                new CaptionFilter(Target.Perspectives, "Adventure Works"),
                new CaptionFilter(Target.Dimensions, "Date"),
                new CaptionFilter(Target.Hierarchies, "Calendar"),
                new CaptionFilter(Target.Levels, "Month")
            });

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(0));
        }
        public void GetPartialMetadata_TabularMeasureGroupsForInternetOperation_ThreeElements()
        {
            var disco = new DiscoveryRequestFactory().BuildDirect(
                ConnectionStringReader.GetAdomdTabular(),
                DiscoveryTarget.MeasureGroups,
                new List <IFilter>()
            {
                new CaptionFilter("Internet Operation", DiscoveryTarget.Perspectives),
            });

            var factory = new AdomdDiscoveryCommandFactory();
            var cmd     = factory.BuildExact(disco);

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(3));
        }
        public void Execute_TabularDateDimensionWithHeighTeenHierarchies_ListStructureContainingSevenTeenElements()
        {
            var disco = new DiscoveryRequestFactory().BuildDirect(
                ConnectionStringReader.GetAdomdTabular(),
                DiscoveryTarget.Hierarchies,
                new List <IFilter>()
            {
                new CaptionFilter("Internet Operation", DiscoveryTarget.Perspectives),
                new CaptionFilter("Date", DiscoveryTarget.Dimensions)
            });

            var factory = new AdomdDiscoveryCommandFactory();
            var cmd     = factory.BuildExact(disco);

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(17));
        }
        public void GetPartialMetadata_TabularCalendarHierarchyWithSixLevels_ListStructureContainingSixElements()
        {
            var disco = new DiscoveryRequestFactory().BuildDirect(
                ConnectionStringReader.GetAdomdTabular(),
                DiscoveryTarget.Levels,
                new List <IFilter>()
            {
                new CaptionFilter("Internet Operation", DiscoveryTarget.Perspectives),
                new CaptionFilter("Date", DiscoveryTarget.Dimensions),
                new CaptionFilter("Calendar", DiscoveryTarget.Hierarchies)
            });

            var factory = new AdomdDiscoveryCommandFactory();
            var cmd     = factory.BuildExact(disco);

            var structs = cmd.Execute();

            Assert.That(structs.Count(), Is.EqualTo(6));
        }
Exemple #13
0
        public void GetMembersDax_ByLevel_ReturnListMembersWithCorrectCaptions()
        {
            //Buiding object used during test
            var mae   = new MembersAdomdEngine();
            var disco = new DiscoveryRequestFactory().Build(
                ConnectionStringReader.GetAdomdTabular(),
                string.Empty,
                "Internet Operation",
                "Geography",
                "Geography",
                "Country Region"
                );

            //Call the method to test
            var actual = mae.GetMembers(disco);

            ////Assertion
            Assert.That(List.Map(actual).Property("Caption"), Has.None.EqualTo("All"));
            Assert.That(List.Map(actual).Property("Caption"), Has.Member("Canada"));
            Assert.That(List.Map(actual).Property("Caption"), Has.Member("France"));
        }