How to use HierarchyXml class of NBi.Xml.Items package

Best NBi code snippet using NBi.Xml.Items.HierarchyXml

MembersEquivalentToBuilderTest.cs

Source:MembersEquivalentToBuilderTest.cs Github

copy

Full Screen

...50 [Test]51 public void GetConstraint_BuildWithQuery_CorrectConstraint()52 {53 var sutXml = new MembersXml();54 var item = new HierarchyXml();55 sutXml.Item = item;56 var ctrXml = new EquivalentToXml();57 ctrXml.Query = new QueryXml();58 ctrXml.Query.ConnectionString = "Data Source=mhknbn2kdz.database.windows.net;Initial Catalog=AdventureWorks2012;User Id=sqlfamily;password=sqlf@m1ly";59 ctrXml.Query.InlineQuery = "select * from one-column-table";6061 var discoFactoStubFactory = new Mock<DiscoveryRequestFactory>();62 discoFactoStubFactory.Setup(dfs =>63 dfs.Build(64 It.IsAny<string>(),65 It.IsAny<string>(),66 It.IsAny<List<string>>(),67 It.IsAny<List<PatternValue>>(),68 It.IsAny<string>(),69 It.IsAny<string>(),70 It.IsAny<string>(),71 It.IsAny<string>()))72 .Returns(new MembersDiscoveryRequest());73 var discoFactoStub = discoFactoStubFactory.Object;7475 var builder = new MembersEquivalentToBuilder(discoFactoStub);76 builder.Setup(sutXml, ctrXml);77 builder.Build();78 var ctr = builder.GetConstraint();7980 Assert.That(ctr, Is.InstanceOf<EquivalentToConstraint>());81 }8283 [Test]84 public void GetConstraint_BuildWithItems_CorrectConstraint()85 {86 var sutXml = new MembersXml();87 var item = new HierarchyXml();88 sutXml.Item = item;89 var ctrXml = new EquivalentToXml();90 ctrXml.Items = new List<string>() { "Hello", "World" };9192 var discoFactoStubFactory = new Mock<DiscoveryRequestFactory>();93 discoFactoStubFactory.Setup(dfs =>94 dfs.Build(95 It.IsAny<string>(),96 It.IsAny<string>(),97 It.IsAny<List<string>>(),98 It.IsAny<List<PatternValue>>(),99 It.IsAny<string>(),100 It.IsAny<string>(),101 It.IsAny<string>(),102 It.IsAny<string>()))103 .Returns(new MembersDiscoveryRequest());104 var discoFactoStub = discoFactoStubFactory.Object;105106 var builder = new MembersEquivalentToBuilder(discoFactoStub);107 builder.Setup(sutXml, ctrXml);108 builder.Build();109 var ctr = builder.GetConstraint();110111 Assert.That(ctr, Is.InstanceOf<EquivalentToConstraint>());112 }113114 [Test]115 public void GetConstraint_BuildWithPredefinedItems_CorrectConstraint()116 {117 var sutXml = new MembersXml();118 var item = new HierarchyXml();119 sutXml.Item = item;120 var ctrXml = new EquivalentToXml();121 ctrXml.PredefinedItems = new PredefinedItemsXml() { Type=PredefinedMembers.DaysOfWeek, Language = "en" };122123 var discoFactoStubFactory = new Mock<DiscoveryRequestFactory>();124 discoFactoStubFactory.Setup(dfs =>125 dfs.Build(126 It.IsAny<string>(),127 It.IsAny<string>(),128 It.IsAny<List<string>>(),129 It.IsAny<List<PatternValue>>(),130 It.IsAny<string>(),131 It.IsAny<string>(),132 It.IsAny<string>(),133 It.IsAny<string>()))134 .Returns(new MembersDiscoveryRequest());135 var discoFactoStub = discoFactoStubFactory.Object;136137 var builder = new MembersEquivalentToBuilder(discoFactoStub);138 builder.Setup(sutXml, ctrXml);139 builder.Build();140 var ctr = builder.GetConstraint();141142 Assert.That(ctr, Is.InstanceOf<EquivalentToConstraint>());143 }144145 [Test]146 public void GetConstraint_BuildWithRange_CorrectConstraint()147 {148 var sutXml = new MembersXml();149 var item = new HierarchyXml();150 sutXml.Item = item;151 var ctrXml = new EquivalentToXml();152 ctrXml.Range = new IntegerRangeXml() { Start = 1, End = 10, Step = 2 };153154 var discoFactoStubFactory = new Mock<DiscoveryRequestFactory>();155 discoFactoStubFactory.Setup(dfs =>156 dfs.Build(157 It.IsAny<string>(),158 It.IsAny<string>(),159 It.IsAny<List<string>>(),160 It.IsAny<List<PatternValue>>(),161 It.IsAny<string>(),162 It.IsAny<string>(),163 It.IsAny<string>(), ...

Full Screen

Full Screen

HierarchyXmlTest.cs

Source:HierarchyXmlTest.cs Github

copy

Full Screen

...78namespace NBi.Testing.Unit.Xml.Items9{10 [TestFixture]11 public class HierarchyXmlTest12 {13 protected TestSuiteXml DeserializeSample()14 {15 // Declare an object variable of the type to be deserialized.16 var manager = new XmlManager();1718 // A Stream is needed to read the XML document.19 using (Stream stream = Assembly.GetExecutingAssembly()20 .GetManifestResourceStream("NBi.Testing.Unit.Xml.Resources.HierarchyXmlTestSuite.xml"))21 using (StreamReader reader = new StreamReader(stream))22 {23 manager.Read(reader);24 }25 return manager.TestSuite;26 }27 28 [Test]29 public void Deserialize_SampleFile_DimensionLoaded()30 {31 int testNr = 0;32 33 // Create an instance of the XmlSerializer specifying type and namespace.34 TestSuiteXml ts = DeserializeSample();3536 // Check the properties of the object.37 Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf<StructureXml>());38 Assert.That(((StructureXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf<HierarchyXml>());3940 HierarchyXml item = (HierarchyXml)((StructureXml)ts.Tests[testNr].Systems[0]).Item;41 Assert.That(item.Dimension, Is.EqualTo("dimension"));42 }4344 [Test]45 public void Deserialize_SampleFile_DisplayFolderLoaded()46 {47 int testNr = 1;4849 // Create an instance of the XmlSerializer specifying type and namespace.50 TestSuiteXml ts = DeserializeSample();5152 // Check the properties of the object.53 Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf<StructureXml>());54 Assert.That(((StructureXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf<HierarchyXml>());5556 HierarchyXml item = (HierarchyXml)((StructureXml)ts.Tests[testNr].Systems[0]).Item;57 Assert.That(item.DisplayFolder, Is.EqualTo("display-folder"));58 Assert.That(item.Specification.IsDisplayFolderSpecified, Is.True);59 }6061 [Test]62 public void Deserialize_SampleFile_DisplayFolderNotSpecified()63 {64 int testNr = 2;6566 // Create an instance of the XmlSerializer specifying type and namespace.67 TestSuiteXml ts = DeserializeSample();6869 // Check the properties of the object.70 Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf<StructureXml>());71 Assert.That(((StructureXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf<HierarchyXml>());7273 HierarchyXml item = (HierarchyXml)((StructureXml)ts.Tests[testNr].Systems[0]).Item;74 Assert.That(item.DisplayFolder, Is.Null.Or.Empty);75 Assert.That(item.Specification.IsDisplayFolderSpecified, Is.False);76 }7778 [Test]79 public void Deserialize_SampleFile_MeasureWithDisplayFolderRoot()80 {81 int testNr = 3;8283 // Create an instance of the XmlSerializer specifying type and namespace.84 TestSuiteXml ts = DeserializeSample();8586 // Check the properties of the object.87 Assert.That(ts.Tests[testNr].Systems[0], Is.TypeOf<StructureXml>());88 Assert.That(((StructureXml)ts.Tests[testNr].Systems[0]).Item, Is.TypeOf<HierarchyXml>());8990 HierarchyXml item = (HierarchyXml)((StructureXml)ts.Tests[testNr].Systems[0]).Item;91 Assert.That(item.DisplayFolder, Is.Empty);92 Assert.That(item.Specification.IsDisplayFolderSpecified, Is.True);93 }9495 96 }97} ...

Full Screen

Full Screen

AbstractMembersBuilder.cs

Source:AbstractMembersBuilder.cs Github

copy

Full Screen

...5758 if (membersXml.Item == null)59 throw new ArgumentNullException();6061 if (!(membersXml.Item is HierarchyXml || membersXml.Item is LevelXml))62 {63 throw new ArgumentOutOfRangeException();64 }6566 if (membersXml.Item is HierarchyXml)67 {68 perspective = ((HierarchyXml)membersXml.Item).Perspective;69 dimension = ((HierarchyXml)membersXml.Item).Dimension;70 hierarchy = membersXml.Item.Caption;71 }72 if (membersXml.Item is LevelXml)73 {74 perspective = ((LevelXml)membersXml.Item).Perspective;75 dimension = ((LevelXml)membersXml.Item).Dimension;76 hierarchy = ((LevelXml)membersXml.Item).Hierarchy;77 level = membersXml.Item.Caption;78 }79 80 var disco = discoveryFactory.Build(81 membersXml.Item.GetConnectionString(),82 membersXml.ChildrenOf,83 membersXml.Exclude.Items, ...

Full Screen

Full Screen

HierarchyXml

Using AI Code Generation

copy

Full Screen

1var hierarchy = new HierarchyXml();2hierarchy.Name = "MyHierarchy";3hierarchy.Caption = "My Hierarchy";4var measure = new MeasureXml();5measure.Name = "MyMeasure";6measure.Caption = "My Measure";7var measureGroup = new MeasureGroupXml();8measureGroup.Name = "MyMeasureGroup";9measureGroup.Caption = "My Measure Group";10measureGroup.Measures.Add(measure);11var cube = new CubeXml();12cube.Name = "MyCube";13cube.Caption = "My Cube";14cube.MeasureGroups.Add(measureGroup);15cube.Hierarchies.Add(hierarchy);16var request = new DiscoveryRequestXml();17request.ConnectionString = "Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AdventureWorks;Data Source=localhost";18request.Cube = cube;19var service = new DiscoveryService();20var result = service.Execute(request);21var resultSet = result.ResultSet;22var reader = new ResultSetReader(resultSet);23while (reader.Read())24{25}26var manager = new ResultSetManager(resultSet);27var table = manager.ToDataTable();28var manager = new ResultSetManager(resultSet);29var csv = manager.ToCsv();30var manager = new ResultSetManager(resultSet);31var xml = manager.ToXml();

Full Screen

Full Screen

HierarchyXml

Using AI Code Generation

copy

Full Screen

1var h = new HierarchyXml("myHierarchy");2h.AddLevel(new LevelXml("myLevel1"));3h.AddLevel(new LevelXml("myLevel2"));4var h = new HierarchyXml("myHierarchy");5h.AddLevel(new LevelXml("myLevel1"));6h.AddLevel(new LevelXml("myLevel2"));7h.AddLevel(new LevelXml("myLevel3"));8var h = new HierarchyXml("myHierarchy");9h.AddLevel(new LevelXml("myLevel1"));10h.AddLevel(new LevelXml("myLevel2"));11h.AddLevel(new LevelXml("myLevel3"));12h.AddLevel(new LevelXml("myLevel4"));13var h = new HierarchyXml("myHierarchy");14h.AddLevel(new LevelXml("myLevel1"));15h.AddLevel(new LevelXml("myLevel2"));16h.AddLevel(new LevelXml("myLevel3"));17h.AddLevel(new LevelXml("myLevel4"));18h.AddLevel(new LevelXml("myLevel5"));19var h = new HierarchyXml("myHierarchy");20h.AddLevel(new LevelXml("myLevel1"));21h.AddLevel(new LevelXml("myLevel2"));22h.AddLevel(new LevelXml("myLevel3"));23h.AddLevel(new LevelXml("myLevel4"));24h.AddLevel(new LevelXml("myLevel5"));25h.AddLevel(new LevelXml("myLevel6"));26var h = new HierarchyXml("myHierarchy");27h.AddLevel(new LevelXml("myLevel1"));28h.AddLevel(new LevelXml("myLevel2"));29h.AddLevel(new LevelXml("myLevel3"));30h.AddLevel(new LevelXml("myLevel4"));31h.AddLevel(new LevelXml("myLevel5"));32h.AddLevel(new LevelXml("myLevel6"));33h.AddLevel(new LevelXml("myLevel7"));

Full Screen

Full Screen

HierarchyXml

Using AI Code Generation

copy

Full Screen

1var hierarchy = new HierarchyXml();2hierarchy.Name = "myHierarchy";3hierarchy.Caption = "My Hierarchy";4hierarchy.DefaultMember = "All";5hierarchy.IsVisible = true;6var level1 = new LevelXml();7level1.Name = "Level1";8level1.Caption = "Level 1";9level1.IsVisible = true;10var level2 = new LevelXml();11level2.Name = "Level2";12level2.Caption = "Level 2";13level2.IsVisible = true;14hierarchy.Levels.Add(level1);15hierarchy.Levels.Add(level2);16var hierarchySet = new HierarchySetXml();17hierarchySet.Hierarchies.Add(hierarchy);18var cube = new CubeXml();19cube.Name = "myCube";20cube.HierarchySet = hierarchySet;21var metadata = new MetadataXml();22metadata.Cubes.Add(cube);23var xml = new DiscoveryRequestXml();24xml.Metadata = metadata;25var constraint = new DiscoveryRequestXml();26constraint.Metadata = metadata;27var ctr = new DiscoveryRequestConstraint();28ctr.Xml = constraint;29var ctrXml = new DiscoveryRequestConstraintXml();30ctrXml.Constraint = ctr;31var ctrSet = new ConstraintSetXml();32ctrSet.Constraints.Add(ctrXml);33var test = new TestCaseXml();34test.Name = "myTest";35test.ConstraintSet = ctrSet;36var suite = new TestSuiteXml();37suite.Tests.Add(test);38var test = new TestCaseXml();39test.Name = "myTest";40test.ConstraintSet = ctrSet;41var suite = new TestSuiteXml();42suite.Tests.Add(test);43var xml = new DiscoveryRequestXml();44xml.Metadata = metadata;45var constraint = new DiscoveryRequestXml();46constraint.Metadata = metadata;47var ctr = new DiscoveryRequestConstraint();48ctr.Xml = constraint;49var ctrXml = new DiscoveryRequestConstraintXml();50ctrXml.Constraint = ctr;51var ctrSet = new ConstraintSetXml();52ctrSet.Constraints.Add(ctrXml);53var test = new TestCaseXml();54test.Name = "myTest";

Full Screen

Full Screen

HierarchyXml

Using AI Code Generation

copy

Full Screen

1var xml = new HierarchyXml();2xml.Name = "Hierarchy";3xml.Caption = "Hierarchy";4xml.IsVisible = true;5xml.IsVirtual = false;6xml.IsSharedDimension = false;7xml.IsReadWrite = true;8xml.IsDateHierarchy = false;9xml.IsTimeHierarchy = false;10xml.IsUserHierarchy = false;11xml.IsUserDefined = false;12xml.IsAggregationHierarchy = false;13xml.IsMeasureHierarchy = false;14xml.IsAllMemberRequired = false;15xml.IsAllMemberVisible = false;16xml.IsDefault = false;17xml.IsHidden = false;18xml.IsNonEmpty = false;19xml.IsMultiple = false;20xml.IsAutomatic = true;21xml.IsCrossfiltering = false;22xml.IsCalculated = false;23xml.IsCalculatedInDatabase = false;24xml.IsNoDrillthrough = false;25xml.IsNoDrillthroughAggregates = false;26xml.IsNoDrillthroughGrandTotal = false;27xml.IsNoDrillthroughSubtotal = false;28xml.IsNoDrillthroughPage = false;29xml.IsNoDrillthroughOnRows = false;30xml.IsNoDrillthroughOnColumns = false;31xml.IsNoDrillthroughOnMeasures = false;32xml.IsNoDrillthroughOnPages = false;33xml.IsNoDrillthroughOnSections = false;34xml.IsNoDrillthroughOnChapters = false;35xml.IsNoDrillthroughOnReports = false;36xml.IsNoDrillthroughOnVisualizations = false;37xml.IsNoDrillthroughOnDashboards = false;38xml.IsNoDrillthroughOnFolders = false;39xml.IsNoDrillthroughOnMembers = false;40xml.IsNoDrillthroughOnAll = false;41xml.IsNoDrillthroughOnAttributes = false;42xml.IsNoDrillthroughOnSets = false;43xml.IsNoDrillthroughOnCalculatedMembers = false;44xml.IsNoDrillthroughOnCalculatedItems = false;45xml.IsNoDrillthroughOnCalculatedTables = false;46xml.IsNoDrillthroughOnCalculatedHierarchies = false;47xml.IsNoDrillthroughOnCalculatedColumns = false;48xml.IsNoDrillthroughOnCalculatedMeasures = false;49xml.IsNoDrillthroughOnCalculatedSets = false;50xml.IsNoDrillthroughOnCalculatedPages = false;

Full Screen

Full Screen

HierarchyXml

Using AI Code Generation

copy

Full Screen

1var hierarchy = new HierarchyXml();2hierarchy.Name = "MyHierarchy";3hierarchy.Captions.Add("MyCaption");4hierarchy.Captions.Add("MyCaption2");5var hiearchyNode = new HierarchyNodeXml();6hiearchyNode.Name = "MyNode";7hiearchyNode.Caption = "MyNodeCaption";8hierarchy.Nodes.Add(hiearchyNode);9var hiearchyNode2 = new HierarchyNodeXml();10hiearchyNode2.Name = "MyNode2";11hiearchyNode2.Caption = "MyNodeCaption2";12hierarchy.Nodes.Add(hiearchyNode2);13var hiearchyNode3 = new HierarchyNodeXml();14hiearchyNode3.Name = "MyNode3";15hiearchyNode3.Caption = "MyNodeCaption3";16hierarchy.Nodes.Add(hiearchyNode3);17hiearchyNode2.Parent = hiearchyNode;18hiearchyNode3.Parent = hiearchyNode2;19var xml = new HierarchyXmlWriter();20xml.Write(hierarchy, "c:\temp\test.xml");21var hierarchy = new HierarchyXml();22hierarchy.Name = "MyHierarchy";23hierarchy.Captions.Add("MyCaption");24hierarchy.Captions.Add("MyCaption2");25var hiearchyNode = new HierarchyNodeXml();26hiearchyNode.Name = "MyNode";27hiearchyNode.Caption = "MyNodeCaption";28hierarchy.Nodes.Add(hiearchyNode);29var hiearchyNode2 = new HierarchyNodeXml();30hiearchyNode2.Name = "MyNode2";31hiearchyNode2.Caption = "MyNodeCaption2";32hierarchy.Nodes.Add(hiearchyNode2);33var hiearchyNode3 = new HierarchyNodeXml();34hiearchyNode3.Name = "MyNode3";35hiearchyNode3.Caption = "MyNodeCaption3";36hierarchy.Nodes.Add(hiearchyNode3);37hiearchyNode2.Parent = hiearchyNode;38hiearchyNode3.Parent = hiearchyNode2;39var xml = new HierarchyXmlWriter();40xml.Write(hierarchy, "c:\temp\test.xml");41var hierarchy = new HierarchyXml();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run NBi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in HierarchyXml

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful