public void GetConstraint_BuildWithQuery_CorrectConstraint() { var sutXml = new MembersXml(); var item = new HierarchyXml(); sutXml.Item = item; var ctrXml = new EquivalentToXml(); ctrXml.Query = new QueryXml(); ctrXml.Query.ConnectionString = "Data Source=mhknbn2kdz.database.windows.net;Initial Catalog=AdventureWorks2012;User Id=sqlfamily;password=sqlf@m1ly"; ctrXml.Query.InlineQuery = "select * from one-column-table"; var discoFactoStubFactory = new Mock <DiscoveryRequestFactory>(); discoFactoStubFactory.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 discoFactoStub = discoFactoStubFactory.Object; var builder = new MembersEquivalentToBuilder(discoFactoStub); builder.Setup(sutXml, ctrXml, null, null, new ServiceLocator()); builder.Build(); var ctr = builder.GetConstraint(); Assert.That(ctr, Is.InstanceOf <EquivalentToConstraint>()); }
public void GetConstraint_Build_CorrectConstraint() { var sutXml = new MembersXml(); var item = new HierarchyXml(); sutXml.Item = item; var ctrXml = new MatchPatternXml(); var discoFactoStubFactory = new Mock <DiscoveryRequestFactory>(); discoFactoStubFactory.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 discoFactoStub = discoFactoStubFactory.Object; var builder = new MembersMatchPatternBuilder(discoFactoStub); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); Assert.That(ctr, Is.InstanceOf <MatchPatternConstraint>()); }
public void GetSystemUnderTest_ConnectionStringInDefault_CorrectlyInitialized() { var sutXml = new MembersXml(); var item = new HierarchyXml() { Perspective = "perspective", Dimension = "dimension", Caption = "hierarchy", Settings = new SettingsXml() { Defaults = new List <DefaultXml>() { new DefaultXml() { ApplyTo = SettingsXml.DefaultScope.SystemUnderTest, ConnectionString = new ConnectionStringXml() { Inline = "connectionString-default" } } } } }; sutXml.Item = item; 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)); }
public void GetSystemUnderTest_ConnectionStringInReference_CorrectlyInitialized() { var sutXml = new MembersXml(); var item = new HierarchyXml(); sutXml.Item = item; item.Perspective = "perspective"; item.Dimension = "dimension"; item.Caption = "hierarchy"; item.ConnectionString = "@ref-connStr"; var settingsXml = new SettingsXml(); settingsXml.References.Add(new ReferenceXml() { Name = "ref-connStr", ConnectionString = new ConnectionStringXml() { Inline = "connectionString-ref" } }); sutXml.Settings = settingsXml; var ctrXml = new CountXml(); 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 MembersCountBuilder(discoFactoMock); builder.Setup(sutXml, ctrXml); builder.Build(); var sut = builder.GetSystemUnderTest(); Assert.That(sut, Is.InstanceOf <MembersDiscoveryRequest>()); discoFactoMockFactory.Verify(dfm => dfm.Build("connectionString-ref", It.IsAny <string>(), It.IsAny <List <string> >(), It.IsAny <List <PatternValue> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), null)); }
public void Deserialize_SampleFile_DimensionLoaded() { int testNr = 0; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <StructureXml>()); Assert.That(((StructureXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf <HierarchyXml>()); HierarchyXml item = (HierarchyXml)((StructureXml)ts.Tests[testNr].Systems[0]).Item; Assert.That(item.Dimension, Is.EqualTo("dimension")); }
public void Deserialize_SampleFile_MeasureWithDisplayFolderRoot() { int testNr = 3; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <StructureXml>()); Assert.That(((StructureXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf <HierarchyXml>()); HierarchyXml item = (HierarchyXml)((StructureXml)ts.Tests[testNr].Systems[0]).Item; Assert.That(item.DisplayFolder, Is.Empty); Assert.That(item.Specification.IsDisplayFolderSpecified, Is.True); }
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)); }
public void Deserialize_SampleFile_MembersWithHierarchy() { int testNr = 1; // Create an instance of the XmlSerializer specifying type and namespace. TestSuiteXml ts = DeserializeSample(); // Check the properties of the object. Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf <MembersXml>()); Assert.That(((MembersXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf <HierarchyXml>()); HierarchyXml item = (HierarchyXml)((MembersXml)ts.Tests[testNr].Systems[0]).Item; Assert.That(item.Dimension, Is.EqualTo("dimension")); Assert.That(item.Caption, Is.EqualTo("hierarchy")); Assert.That(item.Perspective, Is.EqualTo("Perspective")); Assert.That(item.GetConnectionString(), Is.EqualTo("ConnectionString")); }
public void GetSystemUnderTest_ConnectionStringInDefault_CorrectlyInitialized() { var sutXml = new MembersXml(); sutXml.ChildrenOf = "memberCaption"; 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 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)); }
public void GetConstraint_Build_CorrectConstraint() { var sutXml = new StructureXml(); var item = new HierarchyXml(); item.ConnectionString = ConnectionStringReader.GetAdomd(); item.Perspective = "perspective-name"; item.Dimension = "dimension-caption"; item.Caption = "hierarchy-caption"; sutXml.Item = item; var ctrXml = new ExistsXml(); var builder = new StructureExistsBuilder(); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); Assert.That(ctr, Is.InstanceOf <ExistsConstraint>()); }
public void GetConstraint_BuildWithItems_CorrectConstraint() { var sutXml = new MembersXml(); var item = new HierarchyXml(); sutXml.Item = item; var ctrXml = new EquivalentToXml(); ctrXml.Items = new List <string>() { "Hello", "World" }; var discoFactoStubFactory = new Mock <DiscoveryRequestFactory>(); discoFactoStubFactory.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 discoFactoStub = discoFactoStubFactory.Object; var builder = new MembersEquivalentToBuilder(discoFactoStub); builder.Setup(sutXml, ctrXml); builder.Build(); var ctr = builder.GetConstraint(); Assert.That(ctr, Is.InstanceOf <EquivalentToConstraint>()); }