How to use StructureDiscoveryFactoryProvider class of NBi.Core.Structure package

Best NBi code snippet using NBi.Core.Structure.StructureDiscoveryFactoryProvider

StructureDiscoveryFactoryProviderTest.cs

Source: StructureDiscoveryFactoryProviderTest.cs Github

copy

Full Screen

...11using System.Threading.Tasks;12using System.Xml;13namespace NBi.Testing.Core.Structure14{15 public class StructureDiscoveryFactoryProviderTest16 {17 private class FakeStructureDiscoveryFactoryProvider : StructureDiscoveryFactoryProvider18 {19 private readonly string result;20 public FakeStructureDiscoveryFactoryProvider(string result)21 : base()22 {23 this.result = result;24 }25 protected override string InquireFurtherAnalysisService(string connectionString)26 {27 return result;28 }29 public new string ParseXmlaResponse(XmlDocument doc)30 {31 return base.ParseXmlaResponse(doc);32 }33 }34 [Test]35 public void Instantiate_EmptyConnectionString_GetDatabaseStructureDiscoveryFactory()36 {37 var connectionString = string.Empty;38 var provider = new StructureDiscoveryFactoryProvider();39 Assert.Throws<ArgumentNullException>(() => provider.Instantiate(connectionString));40 }41 [Test]42 public void Instantiate_SqlConnection_GetDatabaseStructureDiscoveryFactory()43 {44 var connectionString = ConnectionStringReader.GetSqlClient();45 46 var provider = new StructureDiscoveryFactoryProvider();47 var factory = provider.Instantiate(connectionString);48 Assert.That(factory, Is.TypeOf<RelationalStructureDiscoveryFactory>());49 }50 [Test]51 public void Instantiate_AdomdConnectionOlap_GetDatabaseStructureDiscoveryFactory()52 {53 var connectionString = ConnectionStringReader.GetAdomd();54 var provider = new FakeStructureDiscoveryFactoryProvider(StructureDiscoveryFactoryProvider.Olap);55 var factory = provider.Instantiate(connectionString);56 Assert.That(factory, Is.TypeOf<OlapStructureDiscoveryFactory>());57 }58 [Test]59 public void Instantiate_AdomdConnectionTabular_GetDatabaseStructureDiscoveryFactory()60 {61 var connectionString = ConnectionStringReader.GetAdomd();62 var provider = new FakeStructureDiscoveryFactoryProvider(StructureDiscoveryFactoryProvider.Tabular);63 var factory = provider.Instantiate(connectionString);64 Assert.That(factory, Is.TypeOf<TabularStructureDiscoveryFactory>());65 }66 67 [Test]68 [TestCase("Multidimensional")]69 [TestCase("Tabular")]70 [TestCase("Sharepoint")]71 [TestCase("Default")]72 public void ParseXmlaResponse_Tabular_GetCorrectServerMode(string serverMode)73 {74 var xml = ""75 + "<Server xmlns=\"http:/​/​schemas.microsoft.com/​analysisservices/​2003/​engine\"> "76 + " <Name>XXX\\SQL2014</​Name> "77 + " <ID>XXX\\SQL2014</​ID> "78 + " <CreatedTimestamp>2015-07-02T21:56:04.076667</​CreatedTimestamp> "79 + " <LastSchemaUpdate>2015-07-02T21:56:04.093333</​LastSchemaUpdate> "80 + " <Version>12.0.2000.8</​Version> "81 + " <Edition>Developer64</​Edition> "82 + " <EditionID>2176971986</​EditionID> "83 + " <ddl300:ServerMode xmlns:ddl300=\"http:/​/​schemas.microsoft.com/​analysisservices/​2011/​engine/​300\">$value$</​ddl300:ServerMode>"84 + " <ddl400:ServerLocation xmlns:ddl400=\"http:/​/​schemas.microsoft.com/​analysisservices/​2012/​engine/​400\">OnPremise</​ddl400:ServerLocation>"85 + " <ddl400:DefaultCompatibilityLevel xmlns:ddl400=\"http:/​/​schemas.microsoft.com/​analysisservices/​2012/​engine/​400\">1100</​ddl400:DefaultCompatibilityLevel>"86 + "</​Server> ";87 xml = xml.Replace("$value$", serverMode);88 var doc = new XmlDocument();89 90 doc.LoadXml(xml);91 var provider = new FakeStructureDiscoveryFactoryProvider(null);92 var parsedServerMode = provider.ParseXmlaResponse(doc);93 Assert.That(parsedServerMode, Is.EqualTo(serverMode));94 }95 [Test]96 [TestCase("10.0.200.12")]97 [TestCase("9.1.200")]98 public void ParseXmlaResponse_VersionBefore11_GetCorrectServerMode(string version)99 {100 var xml = ""101 + "<Server xmlns=\"http:/​/​schemas.microsoft.com/​analysisservices/​2003/​engine\"> "102 + " <Name>XXX\\SQL2014</​Name> "103 + " <ID>XXX\\SQL2014</​ID> "104 + " <CreatedTimestamp>2015-07-02T21:56:04.076667</​CreatedTimestamp> "105 + " <LastSchemaUpdate>2015-07-02T21:56:04.093333</​LastSchemaUpdate> "106 + " <Version>$value$</​Version> "107 + " <Edition>Developer64</​Edition> "108 + " <EditionID>2176971986</​EditionID> "109 + "</​Server> ";110 xml = xml.Replace("$value$", version);111 var doc = new XmlDocument();112 doc.LoadXml(xml);113 var provider = new FakeStructureDiscoveryFactoryProvider(null);114 var parsedServerMode = provider.ParseXmlaResponse(doc);115 Assert.That(parsedServerMode, Is.EqualTo("Multidimensional"));116 }117 [Test]118 [TestCase("12.0.200.12")]119 [TestCase("11.1.200")]120 public void ParseXmlaResponse_VersionAfter11_ThrowExceptionImpossibleToGuess(string version)121 {122 var xml = ""123 + "<Server xmlns=\"http:/​/​schemas.microsoft.com/​analysisservices/​2003/​engine\"> "124 + " <Name>XXX\\SQL2014</​Name> "125 + " <ID>XXX\\SQL2014</​ID> "126 + " <CreatedTimestamp>2015-07-02T21:56:04.076667</​CreatedTimestamp> "127 + " <LastSchemaUpdate>2015-07-02T21:56:04.093333</​LastSchemaUpdate> "128 + " <Version>$value$</​Version> "129 + " <Edition>Developer64</​Edition> "130 + " <EditionID>2176971986</​EditionID> "131 + "</​Server> ";132 xml = xml.Replace("$value$", version);133 var doc = new XmlDocument();134 doc.LoadXml(xml);135 var provider = new FakeStructureDiscoveryFactoryProvider(null);136 Assert.Throws<ArgumentException>(delegate { provider.ParseXmlaResponse(doc); });137 }138 }139}...

Full Screen

Full Screen

EquivalentToConstraintTest.cs

Source: EquivalentToConstraintTest.cs Github

copy

Full Screen

...4546 [Test, Category("Olap cube")]47 public void Matches_ActualEqualToExpectation_Success()48 {49 var provider = new StructureDiscoveryFactoryProvider();50 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());51 var discovery = factory.Instantiate(52 Target.Perspectives53 , TargetType.Object54 , new CaptionFilter[]{});5556 var expected = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Sales Summary", "Sales Targets" };57 var ctr = new EquivalentToConstraint(expected);5859 /​/​Method under test60 Assert.That(discovery, ctr);61 }6263 [Test, Category("Olap cube")]64 public void Matches_ActualEqualToExpectationButCaseNonMatching_Success()65 {66 var provider = new StructureDiscoveryFactoryProvider();67 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());68 var discovery = factory.Instantiate(69 Target.Perspectives70 , TargetType.Object71 , new CaptionFilter[] { });7273 var expected = new string[] { "Adventure Works".ToLower(), "Channel Sales".ToUpper(), "Direct Sales", "Finance", "Sales Summary", "Sales Targets" };74 var ctr = new EquivalentToConstraint(expected);75 ctr = ctr.IgnoreCase;7677 /​/​Method under test78 Assert.That(discovery, ctr);7980 }8182 [Test, Category("Olap cube")]83 public void Matches_ActualEqualToExpectationButCaseNonMatching_Failure()84 {85 var provider = new StructureDiscoveryFactoryProvider();86 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());87 var discovery = factory.Instantiate(88 Target.Perspectives89 , TargetType.Object90 , new CaptionFilter[] { });9192 var expected = new string[] { "Adventure Works".ToLower(), "Channel Sales".ToUpper(), "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };93 var ctr = new EquivalentToConstraint(expected);9495 /​/​Method under test96 Assert.That(ctr.Matches(discovery), Is.False);9798 }99100 [Test, Category("Olap cube")]101 public void Matches_ActualMoreThanExpectation_Failure()102 {103 var provider = new StructureDiscoveryFactoryProvider();104 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());105 var discovery = factory.Instantiate(106 Target.Perspectives107 , TargetType.Object108 , new CaptionFilter[] { });109110 var expectedStrings = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };111 var expected = new List<string>();112 expected.AddRange(expectedStrings);113 expected.RemoveAt(0);114 var ctr = new EquivalentToConstraint(expected);115116 /​/​Method under test117 Assert.That(ctr.Matches(discovery), Is.False);118119 }120121 [Test, Category("Olap cube")]122 public void Matches_ActualSubsetOfExpectation_Failure()123 {124 var provider = new StructureDiscoveryFactoryProvider();125 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());126 var discovery = factory.Instantiate(127 Target.Perspectives128 , TargetType.Object129 , new CaptionFilter[] { });130131 var expectedStrings = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };132 var expected = new List<string>();133 expected.AddRange(expectedStrings);134 expected.Add("New perspective");135 var ctr = new EquivalentToConstraint(expected);136137 /​/​Method under test138 Assert.That(ctr.Matches(discovery), Is.False); ...

Full Screen

Full Screen

SubsetOfConstraintTest.cs

Source: SubsetOfConstraintTest.cs Github

copy

Full Screen

...4142 [Test, Category("Olap cube")]43 public void Matches_ActualEqualToExpectation_Success()44 {45 var provider = new StructureDiscoveryFactoryProvider();46 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());47 var discovery = factory.Instantiate(48 Target.Perspectives49 , TargetType.Object50 , new CaptionFilter[] { });5152 var expected = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };53 var ctr = new ContainedInConstraint(expected);5455 /​/​Method under test56 Assert.That(discovery, ctr);5758 }5960 [Test, Category("Olap cube")]61 public void Matches_ActualEqualToExpectationCaseNonMatching_Success()62 {63 var provider = new StructureDiscoveryFactoryProvider();64 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());65 var discovery = factory.Instantiate(66 Target.Perspectives67 , TargetType.Object68 , new CaptionFilter[] { });6970 var expected = new string[] { "Adventure Works".ToUpper(), "Channel Sales".ToLower(), "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };71 var ctr = new ContainedInConstraint(expected);72 ctr = ctr.IgnoreCase;7374 /​/​Method under test75 Assert.That(discovery, ctr);7677 }7879 [Test, Category("Olap cube")]80 public void Matches_ActualMoreThanExpectation_Failure()81 {82 var provider = new StructureDiscoveryFactoryProvider();83 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());84 var discovery = factory.Instantiate(85 Target.Perspectives86 , TargetType.Object87 , new CaptionFilter[] { });8889 var expectedStrings = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };90 var expected = new List<string>();91 expected.AddRange(expectedStrings);92 expected.RemoveAt(0);93 var ctr = new ContainedInConstraint(expected);9495 /​/​Method under test96 Assert.That(ctr.Matches(discovery), Is.False);9798 }99100 [Test, Category("Olap cube")]101 public void Matches_ActualSubsetOfExpectation_Sucess()102 {103 var provider = new StructureDiscoveryFactoryProvider();104 var factory = provider.Instantiate(ConnectionStringReader.GetAdomd());105 var discovery = factory.Instantiate(106 Target.Perspectives107 , TargetType.Object108 , new CaptionFilter[] { });109110 var expectedStrings = new string[] { "Adventure Works", "Channel Sales", "Direct Sales", "Finance", "Mined Customers", "Sales Summary", "Sales Targets" };111 var expected = new List<string>();112 expected.AddRange(expectedStrings);113 expected.Add("New perspective");114 var ctr = new ContainedInConstraint(expected);115116 /​/​Method under test117 Assert.That(ctr.Matches(discovery), Is.True); ...

Full Screen

Full Screen

StructureDiscoveryFactoryProvider

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using NBi.Core.Structure;7using NBi.Core.Structure.Olap;8using NBi.Core.Structure.Relational;9using NBi.Core.Structure.Xml;10{11 {12 static void Main(string[] args)13 {14 StructureDiscoveryFactoryProvider provider = new StructureDiscoveryFactoryProvider();15 StructureDiscoveryRequest request = new StructureDiscoveryRequest();16 request.Type = StructureType.Relational;17 request.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=SSPI;";18 request.CommandText = "SELECT * FROM Production.Product";19 request.CommandType = System.Data.CommandType.Text;20 request.HierarchyNameColumn = "HierarchyName";21 request.LevelNameColumn = "LevelName";22 request.MemberNameColumn = "MemberName";23 request.MemberUniqueNameColumn = "MemberUniqueName";24 request.MemberCaptionColumn = "MemberCaption";25 request.MemberDescriptionColumn = "MemberDescription";26 request.MemberTypeColumn = "MemberType";27 request.MemberOrdinalColumn = "MemberOrdinal";28 request.MemberParentUniqueNameColumn = "MemberParentUniqueName";29 request.MemberDepthColumn = "MemberDepth";

Full Screen

Full Screen

StructureDiscoveryFactoryProvider

Using AI Code Generation

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using NBi.Core.Structure;7using NBi.Core.Structure.Olap;8{9 {10 static void Main(string[] args)11 {12 StructureDiscoveryFactoryProvider provider = new StructureDiscoveryFactoryProvider();13 var factory = provider.GetFactory();14 var command = factory.Instantiate("olap");15 var catalog = command.Execute(connectionString);16 }17 }18}

Full Screen

Full Screen

StructureDiscoveryFactoryProvider

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure;2using NBi.Core.Structure.Olap;3using System;4using System.Collections.Generic;5using System.Linq;6using System.Text;7using System.Threading.Tasks;8{9 {10 static void Main(string[] args)11 {12 StructureDiscoveryFactoryProvider provider = new StructureDiscoveryFactoryProvider();13 var factory = provider.GetFactory(new StructureDiscoveryRequest()14 {15 ConnectionString = "Provider=MSOLAP;Data Source=localhost;Initial Catalog=Adventure Works DW Standard Edition 2008R2;Integrated Security=SSPI;",16 Query = "SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS, {[Product].[Product Categories].[Category].[Clothing].[Women’s Clothing].[Dresses].[Women’s Casual Dresses].Children} ON ROWS FROM [Adventure Works]"17 });18 var discovery = factory.Instantiate();19 var result = discovery.Execute();20 foreach (var item in result.Rows)21 {22 Console.WriteLine(item);23 }24 Console.Read();25 }26 }27}28using NBi.Core;29using NBi.Core.Structure;30using NBi.Core.Structure.Olap;31using System;32using System.Collections.Generic;33using System.Linq;34using System.Text;35using System.Threading.Tasks;36{37 {38 static void Main(string[] args)39 {40 StructureDiscoveryFactoryProvider provider = new StructureDiscoveryFactoryProvider();41 var factory = provider.GetFactory(new StructureDiscoveryRequest()42 {43 ConnectionString = "Provider=MSOLAP;Data Source=localhost;Initial Catalog=Adventure Works DW Standard Edition 2008R2;Integrated Security=SSPI;",44 Query = "SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS, {[Product].[Product Categories].[Category].[Clothing].[Women’s Clothing].[Dresses].[Women’s Casual Dresses].Children} ON ROWS FROM [Adventure Works]"45 });46 var discovery = factory.Instantiate();47 var result = discovery.Execute();48 foreach (var item in result.Rows)49 {50 Console.WriteLine(item);51 }52 Console.Read();53 }54 }55}

Full Screen

Full Screen

StructureDiscoveryFactoryProvider

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Structure;2using NBi.Core.Structure.Olap;3using NBi.Core.Structure.Relational;4using NBi.Core.Structure.Xml;5using NBi.NUnit.Structure;6using NBi.Core.Query;7using NBi.Core.Query.Client;8using NBi.Core.Query.Client;9using NBi.Core.Query.Command;10using NBi.Core.Query.Client;11using NBi.Core.Query.Client;12using NBi.Core.Query.Command;13using NBi.Core.Query.Client;14using NBi.Core.Query.Client;15using NBi.Core.Query.Command;16using NBi.Core.Query.Client;17using NBi.Core.Query.Client;18using NBi.Core.Query.Command;19using NBi.Core.Query.Client;20using NBi.Core.Query.Client;21using NBi.Core.Query.Command;22using NBi.Core.Query.Client;23using NBi.Core.Query.Client;24using NBi.Core.Query.Command;

Full Screen

Full Screen

StructureDiscoveryFactoryProvider

Using AI Code Generation

copy

Full Screen

1var factory = new StructureDiscoveryFactoryProvider();2var discovery = factory.GetFactory("SqlServer");3var cmd = discovery.Instantiate("connectionString");4cmd.Discover();5var factory = new StructureDiscoveryFactoryProvider();6var discovery = factory.GetFactory("SqlServer");7var cmd = discovery.Instantiate("connectionString");8cmd.Discover();9var factory = new StructureDiscoveryFactoryProvider();10var discovery = factory.GetFactory("SqlServer");11var cmd = discovery.Instantiate("connectionString");12cmd.Discover();13var factory = new StructureDiscoveryFactoryProvider();14var discovery = factory.GetFactory("SqlServer");15var cmd = discovery.Instantiate("connectionString");16cmd.Discover();17var factory = new StructureDiscoveryFactoryProvider();18var discovery = factory.GetFactory("SqlServer");19var cmd = discovery.Instantiate("connectionString");20cmd.Discover();21var factory = new StructureDiscoveryFactoryProvider();22var discovery = factory.GetFactory("SqlServer");23var cmd = discovery.Instantiate("connectionString");24cmd.Discover();25var factory = new StructureDiscoveryFactoryProvider();26var discovery = factory.GetFactory("SqlServer");27var cmd = discovery.Instantiate("connectionString");28cmd.Discover();29var factory = new StructureDiscoveryFactoryProvider();30var discovery = factory.GetFactory("SqlServer");31var cmd = discovery.Instantiate("connectionString");32cmd.Discover();33var factory = new StructureDiscoveryFactoryProvider();34var discovery = factory.GetFactory("SqlServer");35var cmd = discovery.Instantiate("connectionString");36cmd.Discover();

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Automate Mouse Clicks With Selenium Python

Sometimes, in our test code, we need to handle actions that apparently could not be done automatically. For example, some mouse actions such as context click, double click, drag and drop, mouse movements, and some special key down and key up actions. These specific actions could be crucial depending on the project context.

Aug&#8217; 20 Updates: Live Interaction In Automation, macOS Big Sur Preview &#038; More

Hey Testers! We know it’s been tough out there at this time when the pandemic is far from gone and remote working has become the new normal. Regardless of all the hurdles, we are continually working to bring more features on-board for a seamless cross-browser testing experience.

Test Optimization for Continuous Integration

“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.

Unveiling Samsung Galaxy Z Fold4 For Mobile App Testing

Hey LambdaTesters! We’ve got something special for you this week. ????

A Comprehensive Guide On JUnit 5 Extensions

JUnit is one of the most popular unit testing frameworks in the Java ecosystem. The JUnit 5 version (also known as Jupiter) contains many exciting innovations, including support for new features in Java 8 and above. However, many developers still prefer to use the JUnit 4 framework since certain features like parallel execution with JUnit 5 are still in the experimental phase.

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful