Exemplo n.º 1
0
        public void GetSystemUnderTest_ConnectionStringInDefault_CorrectlyInitialized()
        {
            var sutXml = new MembersXml()
            {
                ChildrenOf = "memberCaption",
                Item       = new HierarchyXml()
                {
                    Perspective = "perspective",
                    Dimension   = "dimension",
                    Caption     = "hierarchy",
                }
            };

            var defXml = new DefaultXml
            {
                ConnectionString = new ConnectionStringXml()
                {
                    Inline = "connectionString-default"
                }
            };

            sutXml.Default = defXml;

            var ctrXml = new ContainXml();

            var discoFactoMockFactory = new Mock <DiscoveryRequestFactory>();

            discoFactoMockFactory.Setup(dfs =>
                                        dfs.Build(
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <List <string> >(),
                                            It.IsAny <List <PatternValue> >(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>()))
            .Returns(new MembersDiscoveryRequest());
            var discoFactoMock = discoFactoMockFactory.Object;

            var builder = new MembersContainBuilder(discoFactoMock);

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

            Assert.That(sut, Is.InstanceOf <MembersDiscoveryRequest>());
            discoFactoMockFactory.Verify(dfm => dfm.Build("connectionString-default", It.IsAny <string>(), It.IsAny <List <string> >(), It.IsAny <List <PatternValue> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), null));
        }
Exemplo n.º 2
0
        public void GetSystemUnderTest_BuildWithHierarchy_CorrectCallToDiscoverFactory()
        {
            var sutXml = new MembersXml
            {
                ChildrenOf = "memberCaption"
            };
            var item = new HierarchyXml();

            sutXml.Item           = item;
            item.ConnectionString = "connectionString";
            item.Perspective      = "perspective";
            item.Dimension        = "dimension";
            item.Caption          = "hierarchy";
            var ctrXml = new ContainXml
            {
                Items = new List <string>()
                {
                    "caption"
                }
            };

            var discoFactoMockFactory = new Mock <DiscoveryRequestFactory>();

            discoFactoMockFactory.Setup(dfs =>
                                        dfs.Build(
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <List <string> >(),
                                            It.IsAny <List <PatternValue> >(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>()))
            .Returns(new MembersDiscoveryRequest());
            var discoFactoMock = discoFactoMockFactory.Object;

            var builder = new MembersContainBuilder(discoFactoMock);

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

            Assert.That(sut, Is.InstanceOf <MembersDiscoveryRequest>());
            discoFactoMockFactory.Verify(dfm => dfm.Build("connectionString", "memberCaption", It.IsAny <List <string> >(), It.IsAny <List <PatternValue> >(), "perspective", "dimension", "hierarchy", null));
        }