Best NBi code snippet using NBi.Core.Structure.Olap.OlapStructureDiscoveryFactory
OlapStructureDiscoveryFactoryTest.cs
Source:OlapStructureDiscoveryFactoryTest.cs
...15 [Test]16 public void Execute_Perspective_ListStructureContainingCorrectCountOfElements()17 {18 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());19 var factory = new OlapStructureDiscoveryFactory(conn);20 var cmd = factory.Instantiate(Target.Perspectives, TargetType.Object,21 new CaptionFilter[] {22 });2324 var structs = cmd.Execute();2526 Assert.That(structs.Count(), Is.EqualTo(6));27 }2829 [Test]30 public void Execute_AdventureWorksDimensions_ListStructureContainingNotMeasure()31 {32 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());33 var factory = new OlapStructureDiscoveryFactory(conn);34 var cmd = factory.Instantiate(Target.Dimensions, TargetType.Object,35 new CaptionFilter[] { 36 new CaptionFilter(Target.Perspectives, "Adventure Works")37 });3839 var structs = cmd.Execute();4041 Assert.That(structs, Is.Not.Contains("Measures"));42 }4344 [Test]45 public void Execute_DateDimensionWithHeighTeenHierarchies_ListStructureContainingCorrectCountOfElements()46 {47 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());48 var factory = new OlapStructureDiscoveryFactory(conn);49 var cmd = factory.Instantiate(Target.Hierarchies, TargetType.Object,50 new CaptionFilter[] { 51 new CaptionFilter(Target.Perspectives, "Adventure Works"),52 new CaptionFilter(Target.Dimensions, "Date")53 });5455 var structs = cmd.Execute();5657 Assert.That(structs.Count(), Is.EqualTo(18));58 }5960 [Test]61 public void Execute_CalendarHierarchyWithSixLevels_ListStructureContainingCorrectCountOfElements()62 {63 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());64 var factory = new OlapStructureDiscoveryFactory(conn);65 var cmd = factory.Instantiate(Target.Levels, TargetType.Object,66 new CaptionFilter[] {67 new CaptionFilter(Target.Perspectives,"Adventure Works"),68 new CaptionFilter(Target.Dimensions,"Date"),69 new CaptionFilter(Target.Hierarchies,"Calendar")70 });7172 var structs = cmd.Execute();7374 Assert.That(structs.Count(), Is.EqualTo(6));75 }7677 [Test]78 public void Execute_MonthLevelWithTwoProperties_ListStructureContainingCorrectCountOfElements()79 {80 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());81 var factory = new OlapStructureDiscoveryFactory(conn);82 var cmd = factory.Instantiate(Target.Properties, TargetType.Object,83 new CaptionFilter[] {84 new CaptionFilter(Target.Perspectives,"Adventure Works"),85 new CaptionFilter(Target.Dimensions,"Date"),86 new CaptionFilter(Target.Hierarchies,"Calendar"),87 new CaptionFilter(Target.Levels,"Month")88 });89 90 var structs = cmd.Execute();9192 Assert.That(structs.Count(), Is.EqualTo(2));93 }9495 [Test]96 public void Execute_MeasureGroupsForCubeFinance_CorrectCountOfElements()97 {98 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());99 var factory = new OlapStructureDiscoveryFactory(conn);100 var cmd = factory.Instantiate(Target.MeasureGroups, TargetType.Object,101 new CaptionFilter[] {102 new CaptionFilter(Target.Perspectives,"Finance"),103 });104 105 var structs = cmd.Execute();106107 Assert.That(structs.Count(), Is.EqualTo(2));108 }109110 [Test]111 public void Execute_MeasuresForMeasureGroupInternetSales_CorrectCountOfElements()112 {113 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());114 var factory = new OlapStructureDiscoveryFactory(conn);115 var cmd = factory.Instantiate(Target.Measures, TargetType.Object,116 new CaptionFilter[] {117 new CaptionFilter(Target.Perspectives,"Adventure Works"),118 new CaptionFilter(Target.MeasureGroups,"Internet Sales")119 });120121 var structs = cmd.Execute();122123 Assert.That(structs.Count(), Is.EqualTo(14));124 }125126 [Test]127 public void Execute_SetsWithPerspective_ListStructureContainingCorrectCountOfElements()128 {129 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());130 var factory = new OlapStructureDiscoveryFactory(conn);131 var cmd = factory.Instantiate(Target.Sets, TargetType.Object,132 new CaptionFilter[] { 133 new CaptionFilter(Target.Perspectives, "Channel Sales")134 });135136 var structs = cmd.Execute();137138 Assert.That(structs.Count(), Is.EqualTo(4));139 }140141 [Test]142 public void Execute_DateDimensionLinkedTo_ListStructureContainingTenElements()143 {144 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());145 var factory = new OlapStructureDiscoveryFactory(conn);146 var cmd = factory.Instantiate(Target.MeasureGroups, TargetType.Relation,147 new CaptionFilter[] { 148 new CaptionFilter(Target.Perspectives, "Adventure Works")149 , new CaptionFilter(Target.Dimensions, "Date")150 });151152 var structs = cmd.Execute();153154 Assert.That(structs.Count(), Is.EqualTo(10));155 }156157 [Test]158 public void Execute_MeasureGroupSalesOrdersLinkedTo_ListStructureContainingCorrectCountOfElements()159 {160 var conn = new AdomdConnection(ConnectionStringReader.GetAdomd());161 var factory = new OlapStructureDiscoveryFactory(conn);162 var cmd = factory.Instantiate(Target.Dimensions, TargetType.Relation,163 new CaptionFilter[] { 164 new CaptionFilter(Target.Perspectives, "Adventure Works")165 , new CaptionFilter(Target.MeasureGroups, "Sales Orders")166 });167168 var structs = cmd.Execute();169170 Assert.That(structs.Count(), Is.EqualTo(9));171 }172173174 }175
...
OlapStructureDiscoveryFactory.cs
Source:OlapStructureDiscoveryFactory.cs
...11using NBi.Core.Structure.Tabular.Builders;1213namespace NBi.Core.Structure.Olap14{15 class OlapStructureDiscoveryFactory : IStructureDiscoveryFactory16 {17 private readonly AdomdConnection connection;18 public OlapStructureDiscoveryFactory(IDbConnection connection)19 {20 this.connection = connection as AdomdConnection;21 }2223 public StructureDiscoveryCommand Instantiate(Target target, TargetType type, IEnumerable<IFilter> filters)24 {25 if (!(connection is AdomdConnection))26 throw new ArgumentException();2728 var builder = InstantiateBuilder(target, type);29 builder.Build(filters);3031 var cmd = connection.CreateCommand();32 cmd.CommandText = builder.GetCommandText();
...
ExistsConstraintTest.cs
Source:ExistsConstraintTest.cs
...44 [Test, Category("Olap cube")]45 public void ExistsConstraint_ExistingPerspectiveButWrongCaseWithIgnoreCaseFalse_Failure()46 {47 var connection = new AdomdConnection(ConnectionStringReader.GetAdomd());48 var factory = new OlapStructureDiscoveryFactory(connection);49 var command = factory.Instantiate(50 Target.Perspectives51 , TargetType.Object52 , new CaptionFilter[] { 53 });5455 var ctr = new ExistsConstraint("Adventure Works".ToLower());5657 //Method under test58 Assert.Throws<AssertionException>(delegate { Assert.That(command, ctr); });59 }6061 [Test, Category("Olap cube")]62 public void ExistsConstraint_ExistingPerspectiveButWrongCaseWithIgnoreCaseTrue_Success()63 {64 var connection = new AdomdConnection(ConnectionStringReader.GetAdomd());65 var factory = new OlapStructureDiscoveryFactory(connection);66 var command = factory.Instantiate(67 Target.Perspectives68 , TargetType.Object69 , new CaptionFilter[] { 70 });7172 var ctr = new ExistsConstraint("Adventure Works".ToLower());73 ctr = ctr.IgnoreCase;7475 //Method under test76 Assert.That(command, ctr);77 }7879 }
...
OlapStructureDiscoveryFactory
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using NBi.Core.Structure.Olap;7using NBi.Core.Structure;8using NBi.Core.Structure.Olap.Builders;9using NBi.Core.Structure.Olap.Factory;10{11 {12 static void Main(string[] args)13 {14 var factory = new OlapStructureDiscoveryFactory();15 var builder = new StructureDiscoveryCommandBuilder();16 builder.ConnectionString = connectionString;17 builder.DiscoverCommand = new DiscoverCommand(DiscoverCommandType.Cubes);18 var discovery = factory.Instantiate(builder);19 var result = discovery.Execute();20 Console.WriteLine(result.Count);21 Console.ReadLine();22 }23 }24}25using System;26using System.Collections.Generic;27using System.Linq;28using System.Text;29using System.Threading.Tasks;30using NBi.Core.Structure.Olap;31using NBi.Core.Structure;32using NBi.Core.Structure.Olap.Builders;33using NBi.Core.Structure.Olap.Factory;34{35 {36 static void Main(string[] args)37 {38 var factory = new OlapStructureDiscoveryFactory();39 var builder = new StructureDiscoveryCommandBuilder();40 builder.ConnectionString = connectionString;41 builder.DiscoverCommand = new DiscoverCommand(DiscoverCommandType.Dimensions);42 builder.CubeName = "Adventure Works";43 var discovery = factory.Instantiate(builder);44 var result = discovery.Execute();45 Console.WriteLine(result.Count);46 Console.ReadLine();47 }48 }49}50using System;51using System.Collections.Generic;52using System.Linq;53using System.Text;54using System.Threading.Tasks;55using NBi.Core.Structure.Olap;56using NBi.Core.Structure;57using NBi.Core.Structure.Olap.Builders;
OlapStructureDiscoveryFactory
Using AI Code Generation
1using NBi.Core.Structure.Olap;2using NBi.Core.Structure.Olap.Builders;3using NBi.Core.Structure.Olap.Factory;4using NBi.Core.Structure.Olap.PostFilters;5using NBi.Core.Structure.Olap.Providers;6using NBi.Core.Structure.Olap.Rsdl;7using NBi.Core.Structure.Olap.Rsdl.Xml;8using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl;9using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure;10using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube;11using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.Measure;12using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup;13using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure;14using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureGroupReference;15using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureGroupReference.MeasureReference;16using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference;17using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureGroupReference;18using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureGroupReference.MeasureGroupReference;19using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureGroupReference.MeasureReference;20using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureReference;21using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureReference.MeasureGroupReference;22using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureReference.MeasureReference;23using NBi.Core.Structure.Olap.Rsdl.Xml.Rsdl.Structure.Cube.MeasureGroup.Measure.MeasureReference.MeasureReference.MeasureReference.MeasureGroupReference;
OlapStructureDiscoveryFactory
Using AI Code Generation
1using NBi.Core.Structure.Olap;2using NBi.Core.Structure.Olap.Builders;3using NBi.Core.Structure.Olap.Factory;4using NBi.Core.Structure.Olap.Providers;5using System;6using System.Collections.Generic;7using System.Linq;8using System.Text;9using System.Threading.Tasks;10{11 {12 static void Main(string[] args)13 {14 var factory = new OlapStructureDiscoveryFactory();15 var builder = factory.Instantiate(new DiscoveryRequest(DiscoveryTarget.Hierarchies, connectionString));16 var provider = new OlapDiscoveryCommand(builder);17 var result = provider.Execute();18 foreach (var row in result)19 {20 Console.WriteLine(row[0]);21 }22 Console.ReadLine();23 }24 }25}
OlapStructureDiscoveryFactory
Using AI Code Generation
1using NBi.Core.Structure.Olap;2using NBi.Core.Structure;3using NBi.Core.Structure.Olap.Factory;4using NBi.Core.Calculation;5using NBi.Core.Calculation.Grouping;6using NBi.Core.Calculation.Predicate;7using NBi.Core.Calculation.Ranking;8using NBi.Core.Calculation.Ranking.Percentile;9using NBi.Core.Calculation.Ranking.Percentile.Nth;10using NBi.Core.Calculation.Ranking.Percentile.Nth.NthRank;11using NBi.Core.Calculation.Ranking.Percentile.Nth.NthValue;12using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercent;13using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentile;14using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOf;15using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfTotal;16using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfColumn;17using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfRow;18using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotal;19using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfColumn;20using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfRow;21using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfTotal;22using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfColumnOfRow;23using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfRowOfColumn;24using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfColumnOfRowOfTotal;25using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfRowOfColumnOfTotal;26using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfColumnOfTotalOfRow;27using NBi.Core.Calculation.Ranking.Percentile.Nth.NthPercentileOfGrandTotalOfRowOfTotalOfColumn;
OlapStructureDiscoveryFactory
Using AI Code Generation
1using NBi.Core.Structure.Olap;2using NBi.Core.Structure.Olap.Factory;3using NBi.Core.Structure;4using NBi.Core.Structure.Relational;5using NBi.Core.Structure.Relational.Factory;6using System.Collections.Generic;7using System;8using System.Data;9using System.Data.OleDb;10using System.Data.SqlClient;11using System.Linq;12using System.Text;13using System.Threading.Tasks;14{15 {16 static void Main(string[] args)17 {18 OleDbConnection connection = new OleDbConnection(connectionString);19 OleDbCommand command = new OleDbCommand();20 command.CommandText = "SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS, {[Date].[Calendar].[Calendar Year].Members} ON ROWS FROM [Adventure Works]";21 command.Connection = connection;22 connection.Open();23 OleDbDataReader reader = command.ExecuteReader();24 while (reader.Read())25 {26 Console.WriteLine(reader[0].ToString());27 }28 reader.Close();29 connection.Close();30 }31 }32}33using NBi.Core.Olap;34using NBi.Core.Olap.Query;35using NBi.Core.Olap.Query.Command;36using NBi.Core.Olap.Query.Execution;37using System;38using System.Collections.Generic;39using System.Linq;40using System.Text;41using System.Threading.Tasks;42{43 {44 static void Main(string[] args)45 {
OlapStructureDiscoveryFactory
Using AI Code Generation
1using NBi.Core.Structure.Olap;2using NBi.Core.Structure;3using NBi.Core.Structure.Olap.Builders;4using NBi.Core.Structure.Olap.Factory;5using NBi.Core.Query.Client;6using NBi.Core.Query;7using System;8using System.Collections.Generic;9using System.Linq;10using System.Text;11using System.Threading.Tasks;12using System.Data;13using System.Data.OleDb;14using System.Data.SqlClient;15using System.Data.Odbc;16using System.Globalization;17using NBi.Core.Query.Resolver;18using NBi.Core.Query.Execution;19using NBi.Core.Query.Command;20using NBi.Core.Query.Command.Text;21using NBi.Core.Query.Command.Olap;22using NBi.Core.Query.Client;23using NBi.Core.Query.Client.SqlClient;24using NBi.Core.Query.Client.Odbc;25using NBi.Core.Query.Client.OleDb;26using NBi.Core.Query.Client.Olap;27using NBi.Core.Query.Client.Rest;28using NBi.Core.Query.Client.Csv;29using NBi.Core.Query.Client.Json;30using NBi.Core.Calculation;31using NBi.Core.Calculation.Predicate;32using NBi.Core.Calculation.Predicate.Numeric;33using NBi.Core.Calculation.Predicate.Text;34using NBi.Core.Calculation.Predicate.Time;35using NBi.Core.Calculation.Predicate.DateTime;36using NBi.Core.Calculation.Predicate.Logical;
OlapStructureDiscoveryFactory
Using AI Code Generation
1using NBi.Core.Structure.Olap;2using NBi.Core.Structure;3using NBi.Core.Structure.Olap.Builders;4using NBi.Core.Structure;5using NBi.Core.Structure.Olap.Builders;6using NBi.Core;7using NBi.Core;8using NBi.Core;9using NBi.Core;10using NBi.Core;11using NBi.Core;12using NBi.Core;13using NBi.Core;14using NBi.Core;15using NBi.Core;16using NBi.Core;17using NBi.Core;18using NBi.Core;19using NBi.Core;20using NBi.Core;21using NBi.Core;22using NBi.Core;23using NBi.Core;24using NBi.Core;25using NBi.Core;26using NBi.Core;27using NBi.Core;28using NBi.Core;29using NBi.Core;
OlapStructureDiscoveryFactory
Using AI Code Generation
1public static List<string> GetCubes()2{3 var connectionString = "Provider=MSOLAP;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Adventure Works DW 2008R2;Data Source=AdventureWorks";4 var factory = new OlapStructureDiscoveryFactory();5 var discoveryCommand = factory.Instantiate(new DiscoveryRequestFactory().Build("cubes", connectionString));6 var result = discoveryCommand.Execute();7 return result.Rows.Select(r => r[0].ToString()).ToList();8}
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!