public void GetSystemUnderTest_BuildWithHierarchy_CorrectCallToDiscoverFactory() { var sutXml = new MembersXml(); sutXml.ChildrenOf = "memberCaption"; var item = new HierarchyXml(); sutXml.Item = item; item.ConnectionString = "connectionString"; item.Perspective = "perspective"; item.Dimension = "dimension"; item.Caption = "hierarchy"; var ctrXml = new OrderedXml(); 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 MembersOrderedBuilder(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)); }
public void GetSystemUnderTest_ConnectionStringInDefault_CorrectlyInitialized() { var sutXml = new MembersXml(); var item = new HierarchyXml(); sutXml.Item = item; item.Perspective = "perspective"; item.Dimension = "dimension"; item.Caption = "hierarchy"; var defXml = new DefaultXml(); defXml.ConnectionString = "connectionString-default"; sutXml.Default = defXml; var ctrXml = new OrderedXml(); 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 MembersOrderedBuilder(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)); }