How to use GetTargetRelation method of NBi.NUnit.Builder.MetadataDiscoveryRequestBuilder class

Best NBi code snippet using NBi.NUnit.Builder.MetadataDiscoveryRequestBuilder.GetTargetRelation

MetadataDiscoveryRequestBuilder.cs

Source:MetadataDiscoveryRequestBuilder.cs Github

copy

Full Screen

...49 return DiscoveryTarget.Sets;50 throw new ArgumentException();51 }5253 private DiscoveryTarget GetTargetRelation(object item)54 {55 if (item is MeasureGroupsXml || item is MeasureGroupXml)56 return DiscoveryTarget.Dimensions;57 if (item is DimensionsXml || item is DimensionXml)58 return DiscoveryTarget.MeasureGroups;5960 throw new ArgumentException();61 }6263 private DiscoveryTarget GetTargetForProperty(string propertyName)64 {65 if (propertyName == "DisplayFolder")66 return DiscoveryTarget.DisplayFolders;67 if (propertyName=="MeasureGroup")68 return DiscoveryTarget.MeasureGroups;69 if (propertyName == "Level")70 return DiscoveryTarget.Levels;71 if (propertyName == "Hierarchy")72 return DiscoveryTarget.Hierarchies;73 if (propertyName == "Dimension")74 return DiscoveryTarget.Dimensions;75 if (propertyName == "Table")76 return DiscoveryTarget.Tables;77 if (propertyName == "Perspective")78 return DiscoveryTarget.Perspectives;7980 throw new ArgumentException();81 }8283 private IFilter BuildCaptionFilter(object src, string propertyName)84 {85 var caption = GetPropertyValue(src, propertyName);86 if (string.IsNullOrEmpty(caption))87 return null;8889 var target = GetTargetForProperty(propertyName);90 var filter = new CaptionFilter(caption, target);91 return filter;9293 }9495 private IFilter BuildCaptionFilterForCaptionProperty(object src, DiscoveryTarget target)96 {97 var caption = GetPropertyValue(src, "Caption");98 if (string.IsNullOrEmpty(caption))99 return null;100101 var filter = new CaptionFilter(caption, target);102 return filter;103 }104105 internal MetadataDiscoveryRequest Build(AbstractItem item, MetadataDiscoveryRequestType type)106 {107 var properties = new string[] { "Perspective", "Dimension", "Hierarchy", "Level", "Property", "MeasureGroup", "DisplayFolder", "Measure", "Table", "Column" };108109 IFilter filter = null;110 var filters = new List<IFilter>();111 foreach (var property in properties)112 {113 filter = BuildCaptionFilter(item, property);114 if (filter != null)115 filters.Add(filter);116 }117118 var target = GetTarget(item);119120 filter = BuildCaptionFilterForCaptionProperty(item, target);121 if (filter != null)122 filters.Add(filter);123124 var connectionString = new ConnectionStringHelper().Execute(item, Xml.Settings.SettingsXml.DefaultScope.SystemUnderTest);125126 var factory = new DiscoveryRequestFactory();127 MetadataDiscoveryRequest request = null;128 switch (type)129 {130 case MetadataDiscoveryRequestType.Direct:131 request = factory.BuildDirect(connectionString, target, filters);132 break;133 case MetadataDiscoveryRequestType.Relation:134 target = GetTargetRelation(item);135 request = factory.BuildRelation(connectionString, target, filters);136 break;137 default:138 break;139 }140 return request;141 } 142143 144 }145} ...

Full Screen

Full Screen

GetTargetRelation

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.NUnit.Builder;7{8 {9 static void Main(string[] args)10 {11 MetadataDiscoveryRequestBuilder builder = new MetadataDiscoveryRequestBuilder();12 var relation = builder.GetTargetRelation("AdventureWorks", "Sales.SalesOrderDetail");13 Console.WriteLine(relation);14 Console.ReadLine();15 }16 }17}18using System;19using System.Collections.Generic;20using System.Linq;21using System.Text;22using System.Threading.Tasks;23using NBi.NUnit.Builder;24{25 {26 static void Main(string[] args)27 {28 MetadataDiscoveryRequestBuilder builder = new MetadataDiscoveryRequestBuilder();29 var relation = builder.GetTargetRelation("AdventureWorks", "Sales.SalesOrderDetail");30 Console.WriteLine(relation);31 Console.ReadLine();32 }33 }34}

Full Screen

Full Screen

GetTargetRelation

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.NUnit.Builder;7using NBi.NUnit.Structure;8using NUnit.Framework;9{10 {11 private MetadataDiscoveryRequestBuilder builder;12 public void SetUp()13 {14 builder = new MetadataDiscoveryRequestBuilder();15 }16 public void GetTargetRelationTest()17 {18 builder.Setup("Database", "Schema", "Table");19 Assert.That(builder.GetTargetRelation(), Is.EqualTo("Database.Schema.Table"));20 }21 }22}

Full Screen

Full Screen

GetTargetRelation

Using AI Code Generation

copy

Full Screen

1using NBi.NUnit.Builder;2using NBi.NUnit.Query;3using NBi.NUnit.Query.Scalar;4using NBi.NUnit.Structure;5using NBi.Xml.Constraints;6using NBi.Xml.Items;7using NBi.Xml.Settings;8using NBi.Xml.Systems;9using NBi.Xml.Variables;10using NUnit.Framework;11using System;12using System.Collections.Generic;13using System.Linq;14using System.Text;15using System.Threading.Tasks;16{17 {18 public void GetTargetRelation_SimpleQuery_ValidRelation()19 {20 var builder = new MetadataDiscoveryRequestBuilder();21 var request = builder.GetTargetRelation("SELECT 1");22 Assert.That(request, Is.EqualTo("1"));23 }24 public void GetTargetRelation_SimpleQueryWithAlias_ValidRelation()25 {26 var builder = new MetadataDiscoveryRequestBuilder();27 var request = builder.GetTargetRelation("SELECT 1 AS MyAlias");28 Assert.That(request, Is.EqualTo("MyAlias"));29 }30 public void GetTargetRelation_ComplexQuery_ValidRelation()31 {32 var builder = new MetadataDiscoveryRequestBuilder();33 var request = builder.GetTargetRelation("SELECT 1 FROM MyTable");34 Assert.That(request, Is.EqualTo("MyTable"));35 }36 public void GetTargetRelation_ComplexQueryWithAlias_ValidRelation()37 {38 var builder = new MetadataDiscoveryRequestBuilder();39 var request = builder.GetTargetRelation("SELECT 1 FROM MyTable AS MyAlias");40 Assert.That(request, Is.EqualTo("MyAlias"));41 }42 public void GetTargetRelation_ComplexQueryWithAliasAndWhere_ValidRelation()43 {44 var builder = new MetadataDiscoveryRequestBuilder();45 var request = builder.GetTargetRelation("SELECT 1 FROM MyTable AS MyAlias WHERE MyColumn = 1");46 Assert.That(request, Is.EqualTo("MyAlias"));47 }48 public void GetTargetRelation_ComplexQueryWithAliasAndWhereAndOrderBy_ValidRelation()49 {50 var builder = new MetadataDiscoveryRequestBuilder();51 var request = builder.GetTargetRelation("SELECT 1 FROM MyTable AS MyAlias WHERE MyColumn = 1 ORDER BY MyColumn");52 Assert.That(request, Is.EqualTo("MyAlias"));53 }

Full Screen

Full Screen

GetTargetRelation

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.Query;7using NBi.NUnit.Builder;8using NBi.Core.Query.Resolver;9using NBi.Core.Query.Client;10using NBi.Core.Query.Command;11using NBi.Core.Query.Execution;12using NBi.Core.Query.Resolver.Catalog;13using NBi.Core.Query.Resolver.Command;14using NBi.Core.Query.Resolver.Database;15using NBi.Core.Query.Resolver.Virtualization;16using NBi.Core.Query.Resolver.Variables;17using NBi.Core.Query.Resolver.Variables.NCalc;18using NBi.Core.Query.Resolver.Variables.Regex;19using NBi.Core.Query.Resolver.Variables.System;20using NBi.Core.Query.Resolver.Variables.System.Environment;21using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder;22using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.MyDocuments;23using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.MyMusic;24using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.MyPictures;25using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.ProgramFiles;26using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.ProgramFilesX86;27using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.System;28using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.SystemX86;29using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.Windows;30using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.WindowsX86;31using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.WindowsX64;32using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.WindowsX86X64;33using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonProgramFiles;34using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonProgramFilesX86;35using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonProgramFilesX86X64;36using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonProgramFilesX64;37using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonApplicationData;38using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonApplicationDataX86;39using NBi.Core.Query.Resolver.Variables.System.Environment.SpecialFolder.CommonApplicationDataX86X64;

Full Screen

Full Screen

GetTargetRelation

Using AI Code Generation

copy

Full Screen

1using NBi.NUnit.Builder;2using NBi.NUnit.Builder.Helper;3using NBi.Xml.Constraints;4using NBi.Xml.Items;5using NBi.Xml.Settings;6using NUnitCtr = NUnit.Framework.Constraints;7using NUnit.Framework;8using System;9using System.Collections.Generic;10using System.Linq;11using System.Text;12using System.Threading.Tasks;13using System.Data;14using NBi.Core.Query;15using NBi.Core.Query.Command;16using NBi.Core.Query.Resolver;17using NBi.Core.Query.Resolver.CommandBuilder;18using NBi.Core.Query.Resolver.Lookup;19using NBi.Core.Query.Resolver.Csv;20using NBi.Core.Query.Resolver.Variables;21using NBi.Core.Query.Resolver.Providers;22using NBi.Core.Query.Resolver.Providers.Odbc;23using NBi.Core.Query.Resolver.Providers.SqlServer;24using NBi.Core.Query.Resolver.Providers.MySql;25using NBi.Core.Query.Resolver.Providers.PostgreSql;26using NBi.Core.Query.Resolver.Providers.Redshift;27using NBi.Core.Query.Resolver.Providers.SqLite;28using NBi.Core.Query.Resolver.Providers.Access;29using NBi.Core.Query.Resolver.Providers.Oracle;30using NBi.Core.Query.Resolver.Providers.Xml;31using NBi.Core.Query.Resolver.Providers.Json;32using NBi.Core.Query.Resolver.Providers.Csv;33using NBi.Core.Query.Resolver.Providers.Excel;34using NBi.Core.Query.Resolver.Providers.Presto;35using NBi.Core.Query.Resolver.Providers.CData;36using NBi.Core.Query.Resolver.Providers.Ado;37{38 {39 private MetadataDiscoveryRequestBuilder GetBuilder()40 {41 return new MetadataDiscoveryRequestBuilder();42 }43 public void GetTargetRelation_WithConnectionInfoAndQuery_ReturnTargetRelation()44 {45 var builder = GetBuilder();46 var xml = new MetadataDiscoveryRequestXml();47 xml.Connection = new ConnectionStringXml();48 xml.Connection.ConnectionString = "Provider=SQLNCLI11;Data Source=.;Integrated Security=SSPI;Initial Catalog=AdventureWorks2014";49 xml.Query = "select * from [HumanResources].[Employee]";50 var targetRelation = builder.GetTargetRelation(xml);51 Assert.That(targetRelation, Is.Not.Null);52 Assert.That(targetRelation.Columns.Count, Is.EqualTo(11));53 }

Full Screen

Full Screen

GetTargetRelation

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.NUnit.Builder;7using NBi.Core.Query;8using NBi.Core;9{10 {11 static void Main(string[] args)12 {13 MetadataDiscoveryRequestBuilder md = new MetadataDiscoveryRequestBuilder();14 var relation = md.GetTargetRelation(new TableQuery("dbo", "Table1"), new TableQuery("dbo", "Table2"));

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful