コード例 #1
0
        public void Instantiate_SqlConnection_GetDatabaseStructureDiscoveryFactory()
        {
            var connectionString = ConnectionStringReader.GetSqlClient();

            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(connectionString);
            Assert.That(factory, Is.TypeOf<RelationalStructureDiscoveryFactory>());
        }
コード例 #2
0
        public void Matches_ActualEqualToExpectation_Success()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Perspectives
                        , TargetType.Object
                        , new CaptionFilter[] { });

            var expected = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };
            var ctr = new SubsetOfConstraint(expected);

            //Method under test
            Assert.That(discovery, ctr);
        }
コード例 #3
0
        public void ContainConstraint_FindExistingDimension_Success()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Dimensions
                        , TargetType.Object
                        , new CaptionFilter[] {new CaptionFilter(Target.Perspectives, "Adventure Works")}
                        );

            var ctr = new ContainConstraint("Product");

            //Method under test
            Assert.That(discovery, ctr);
        }
コード例 #4
0
        public void Matches_ActualEqualToExpectationButCaseNonMatching_Failure()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Perspectives
                        , TargetType.Object
                        , new CaptionFilter[] { });

            var expected = new string[] { "Adventure Works".ToLower(), "Channel Sales".ToUpper(), "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };
            var ctr = new EquivalentToConstraint(expected);

            //Method under test
            Assert.That(ctr.Matches(discovery), Is.False);
        }
コード例 #5
0
        public void LinkedToConstraint_ExistingPerspectiveDimensionAndNotExistingMeasureGroup_Failure()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.MeasureGroups
                        , TargetType.Relation
                        , new CaptionFilter[] {
                            new CaptionFilter(Target.Perspectives, "Adventure Works")
                            , new CaptionFilter(Target.Dimensions, "Customer")
                        });

            var ctr = new LinkedToConstraint("Not existing");

            //Method under test
            Assert.Throws<AssertionException>(delegate { Assert.That(discovery, ctr); });
        }
コード例 #6
0
        public void LinkedToConstraint_ExistingPerspectiveDimensionAndMeasureGroupLinked_Success()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.MeasureGroups
                        , TargetType.Relation
                        , new CaptionFilter[] {
                            new CaptionFilter(Target.Perspectives, "Adventure Works")
                            , new CaptionFilter(Target.Dimensions, "Customer")
                        });

            var ctr = new LinkedToConstraint("Internet Sales");

            //Method under test
            Assert.That(discovery, ctr);
        }
コード例 #7
0
        public void Matches_ActualMoreThanExpectation_Failure()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Perspectives
                        , TargetType.Object
                        , new CaptionFilter[] { });

            var expectedStrings = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };
            var expected = new List<string>();
            expected.AddRange(expectedStrings);
            expected.RemoveAt(0);
            var ctr = new SubsetOfConstraint(expected);

            //Method under test
            Assert.That(ctr.Matches(discovery), Is.False);
        }
コード例 #8
0
 internal StructureContainBuilder(StructureDiscoveryFactoryProvider provider)
     : base(provider)
 {
 }
コード例 #9
0
        public void ContainConstraint_FindExistingMeasureWithCaseNonMatching_Success()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Measures
                        , TargetType.Object
                        , new CaptionFilter[] {
                                new CaptionFilter(Target.Perspectives, "Adventure Works")
                                , new CaptionFilter(Target.MeasureGroups, "Reseller Orders")
                        });

            var ctr = new ContainConstraint("Reseller Order Count".ToLower());
            ctr = ctr.IgnoreCase;

            //Method under test
            Assert.That(discovery, ctr);
        }
コード例 #10
0
        public void Matches_ExpectedNotContainedInActual_Failure()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Perspectives
                        , TargetType.Object
                        , new CaptionFilter[] { });

            var ctr = new ContainConstraint("Not existing");

            //Method under test
            Assert.That(ctr.Matches(discovery), Is.False);
        }
コード例 #11
0
        public void Matches_ExpectedContainedInActual_Success()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Perspectives
                        , TargetType.Object
                        , new CaptionFilter[] { });

            var ctr = new ContainConstraint("Adventure Works");

            //Method under test
            Assert.That(discovery, ctr);
        }
コード例 #12
0
 internal StructureLinkedToBuilder(StructureDiscoveryFactoryProvider discoveryProvider)
     : base(discoveryProvider)
 {
 }
コード例 #13
0
        public void ContainConstraint_FindNonExistingLevel_Failure()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Levels
                        , TargetType.Object
                        , new CaptionFilter[] {
                                new CaptionFilter(Target.Perspectives, "Adventure Works")
                                , new CaptionFilter(Target.Dimensions, "Product")
                                , new CaptionFilter(Target.Hierarchies, "Customer Geography")
                        });

            var ctr = new ContainConstraint("Not existing");

            //Method under test
            Assert.That(ctr.Matches(discovery), Is.False);
        }
コード例 #14
0
 internal StructureSubsetOfBuilder(StructureDiscoveryFactoryProvider provider)
     : base(provider)
 {
 }
コード例 #15
0
 public AbstractStructureBuilder()
 {
     discoveryProvider = new StructureDiscoveryFactoryProvider();
 }
コード例 #16
0
        public void ContainConstraint_FindNonExistingMeasure_Failure()
        {
            var provider = new StructureDiscoveryFactoryProvider();
            var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());
            var discovery = factory.Instantiate(
                        Target.Measures
                        , TargetType.Object
                        , new CaptionFilter[] {
                                new CaptionFilter(Target.Perspectives, "Adventure Works")
                                , new CaptionFilter(Target.MeasureGroups, "Reseller Orders")
                        });

            var ctr = new ContainConstraint("Not existing");

            //Method under test
            Assert.That(ctr.Matches(discovery), Is.False);
        }
コード例 #17
0
 internal AbstractStructureBuilder(StructureDiscoveryFactoryProvider discoveryProvider)
 {
     this.discoveryProvider = discoveryProvider;
 }
コード例 #18
0
 internal StructureExistsBuilder(StructureDiscoveryFactoryProvider discoveryProvider)
     : base(discoveryProvider)
 {
 }