How to use GetExecutionEngineFactory method of NBi.Core.Injection.ServiceLocator class

Best NBi code snippet using NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory

ServiceLocatorTest.cs

Source:ServiceLocatorTest.cs Github

copy

Full Screen

...196 var obj2 = locator.GetConfiguration();197 Assert.That(obj1, Is.EqualTo(obj2));198 }199 [Test]200 public void GetExecutionEngineFactory_NoConfig_Instance()201 {202 var locator = new ServiceLocator();203 var obj = locator.GetExecutionEngineFactory();204 Assert.That(obj, Is.Not.Null);205 Assert.IsInstanceOf<ExecutionEngineFactory>(obj);206 }207 [Test]208 public void GetExecutionEngineFactory_NoConfig_NotSingleton()209 {210 var locator = new ServiceLocator();211 var obj1 = locator.GetExecutionEngineFactory();212 var obj2 = locator.GetExecutionEngineFactory();213 Assert.That(obj1, Is.Not.EqualTo(obj2));214 }215 [Test]216 public void GetExecutionEngineFactory_Config_ConfigAvailable()217 {218 var locator = new ServiceLocator();219 var obj1 = locator.GetExecutionEngineFactory();220 Assert.That(obj1.ExtensionCount, Is.EqualTo(0));221 var config = locator.GetConfiguration();222 var extensions = new Dictionary<Type, IDictionary<string, string>>223 {224 { typeof(FakeSessionFactory), new Dictionary<string, string>() },225 { typeof(FakeCommandFactory), new Dictionary<string, string>() },226 { typeof(FakeExecutionEngine), new Dictionary<string, string>() },227 };228 config.LoadExtensions(extensions);229 var obj2 = locator.GetExecutionEngineFactory();230 Assert.That(obj2.ExtensionCount, Is.EqualTo(1));231 }232 }233}...

Full Screen

Full Screen

ExecutionEngineFactoryTest.cs

Source:ExecutionEngineFactoryTest.cs Github

copy

Full Screen

...24 var query = Mock.Of<IQuery>(25 x => x.ConnectionString == ConnectionStringReader.GetSqlClient()26 && x.Statement == "select 1"27 );28 var factory = serviceLocator.GetExecutionEngineFactory();29 var engine = factory.Instantiate(query);30 Assert.IsInstanceOf<SqlExecutionEngine>(engine);31 }32 [Test]33 public void Instantiate_Adomd_AdomdExecutionEngine()34 {35 var query = Mock.Of<IQuery>(36 x => x.ConnectionString == ConnectionStringReader.GetAdomd()37 && x.Statement == "select 1 on 0"38 );39 var factory = serviceLocator.GetExecutionEngineFactory();40 var engine = factory.Instantiate(query);41 Assert.IsInstanceOf<AdomdExecutionEngine>(engine);42 }43 [Test]44 public void Instantiate_Odbc_OdbcExecutionEngine()45 {46 var query = Mock.Of<IQuery>(47 x => x.ConnectionString == ConnectionStringReader.GetOdbcSql()48 && x.Statement == "select 1"49 );50 var factory = serviceLocator.GetExecutionEngineFactory();51 var engine = factory.Instantiate(query);52 Assert.IsInstanceOf<OdbcExecutionEngine>(engine);53 }54 [Test]55 public void Instantiate_OleDb_OleDbExecutionEngine()56 {57 var query = Mock.Of<IQuery>(58 x => x.ConnectionString == ConnectionStringReader.GetOleDbSql()59 && x.Statement == "select 1"60 );61 var factory = serviceLocator.GetExecutionEngineFactory();62 var engine = factory.Instantiate(query);63 Assert.IsInstanceOf<OleDbExecutionEngine>(engine);64 }65 #region Fake66 public class FakeSession : IClient67 {68 public string ConnectionString => "fake://MyConnectionString";69 public Type UnderlyingSessionType => typeof(object);70 public object CreateNew() => throw new NotImplementedException();71 }72 public class FakeSessionFactory : IClientFactory73 {74 public bool CanHandle(string connectionString) => connectionString.StartsWith("fake://");75 public IClient Instantiate(string connectionString) => new FakeSession();76 }77 public class FakeCommand : ICommand78 {79 public object Implementation => new FakeImplementationCommand();80 public object Client => new FakeSession();81 public object CreateNew() => throw new NotImplementedException();82 }83 public class FakeImplementationCommand84 { }85 public class FakeCommandFactory : ICommandFactory86 {87 public bool CanHandle(IClient session) => session is FakeSession;88 public ICommand Instantiate(IClient session, IQuery query, ITemplateEngine engine) => new FakeCommand();89 }90 [SupportedCommandType(typeof(FakeImplementationCommand))]91 private class FakeExecutionEngine : IExecutionEngine92 {93 public FakeExecutionEngine(FakeSession session, object command)94 { }95 public DataSet Execute() => throw new NotImplementedException();96 public IEnumerable<T> ExecuteList<T>() => throw new NotImplementedException();97 public object ExecuteScalar() => throw new NotImplementedException();98 }99 #endregion100 [Test]101 public void Instantiate_FakeConnectionString_FakeExecutionEngine()102 {103 var localServiceLocator = new ServiceLocator();104 var query = Mock.Of<IQuery>(x => x.ConnectionString == "fake://MyConnectionString");105 var sessionFactory = localServiceLocator.GetSessionFactory();106 sessionFactory.RegisterFactories(new[] { typeof(FakeSessionFactory) });107 var commandFactory = localServiceLocator.GetCommandFactory();108 commandFactory.RegisterFactories(new[] { typeof(FakeCommandFactory) });109 var factory = new ExecutionEngineFactory(sessionFactory, commandFactory);110 factory.RegisterEngines(new[] { typeof(FakeExecutionEngine) });111 var engine = factory.Instantiate(query);112 Assert.IsInstanceOf<FakeExecutionEngine>(engine);113 }114 [Test]115 public void Instantiate_FakeConnectionStringExtensions_FakeExecutionEngine()116 {117 var localServiceLocator = new ServiceLocator();118 var setupConfig = localServiceLocator.GetConfiguration();119 var extensions = new Dictionary<Type, IDictionary<string, string>>120 {121 { typeof(FakeSessionFactory), new Dictionary<string, string>() },122 { typeof(FakeCommandFactory), new Dictionary<string, string>() },123 { typeof(FakeExecutionEngine), new Dictionary<string, string>() },124 };125 setupConfig.LoadExtensions(extensions);126 var query = Mock.Of<IQuery>(x => x.ConnectionString == "fake://MyConnectionString");127 var factory = localServiceLocator.GetExecutionEngineFactory();128 var engine = factory.Instantiate(query);129 Assert.IsInstanceOf<FakeExecutionEngine>(engine);130 }131 }132}...

Full Screen

Full Screen

QuerySequenceResolverTest.cs

Source:QuerySequenceResolverTest.cs Github

copy

Full Screen

...30 var executionEngine = Mock.Of<IExecutionEngine>(x => x.ExecuteList<string>() == new List<string>() { "foo", "bar" });31 var executionEngineFactory = Mock.Of<ExecutionEngineFactory>(x => x.Instantiate(It.IsAny<IQuery>()) == executionEngine);32 var queryResolverFactory = new ServiceLocator().GetQueryResolverFactory();33 var serviceLocator = Mock.Of<ServiceLocator>(34 x => x.GetExecutionEngineFactory() == executionEngineFactory35 && x.GetQueryResolverFactory() == queryResolverFactory36 );37 var resolver = new QuerySequenceResolver<string>(args, serviceLocator);38 var elements = resolver.Execute();39 Assert.That(elements.Count(), Is.EqualTo(2));40 Assert.That(elements, Has.Member("foo"));41 Assert.That(elements, Has.Member("bar"));42 }43 [Test]44 public void Execute_QueryEmbedded_CorrectCallsToServiceLocatorMethods()45 {46 var queryArgs = new EmbeddedQueryResolverArgs(47 "select * from table"48 , "server=.;initiatl catalog=db;integrated security=true"49 , null50 , null51 , new TimeSpan(0, 0, 30)52 );53 var args = new QuerySequenceResolverArgs(queryArgs);54 var executionEngine = Mock.Of<IExecutionEngine>(x => x.ExecuteList<string>() == new List<string>() { "foo", "bar" });55 var executionEngineFactory = Mock.Of<ExecutionEngineFactory>(x => x.Instantiate(It.IsAny<IQuery>()) == executionEngine);56 var queryResolverFactory = new ServiceLocator().GetQueryResolverFactory();57 var serviceLocator = Mock.Of<ServiceLocator>(58 x => x.GetExecutionEngineFactory() == executionEngineFactory59 && x.GetQueryResolverFactory() == queryResolverFactory60 );61 var resolver = new QuerySequenceResolver<string>(args, serviceLocator);62 var elements = resolver.Execute();63 Mock.Get(executionEngine).Verify(x => x.ExecuteList<string>(), Times.Once);64 Mock.Get(executionEngineFactory).Verify(x => x.Instantiate(It.IsAny<IQuery>()), Times.Once);65 }66 }67}...

Full Screen

Full Screen

GetExecutionEngineFactory

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.Injection;7using NBi.Core.Etl;8using NBi.Core.Etl.Execution;9using NBi.Core.Etl.Execution.Jobs;10using NBi.Core.Etl.Execution.Jobs.Cmd;11using NBi.Core.Etl.Execution.Jobs.Dts;12using NBi.Core.Etl.Execution.Jobs.Dtsx;13using NBi.Core.Etl.Execution.Jobs.Odbc;14using NBi.Core.Etl.Execution.Jobs.OleDb;15using NBi.Core.Etl.Execution.Jobs.SqlServer;16using NBi.Core.Etl.Execution.Jobs.Tap;17using NBi.Core.Etl.Execution.Jobs.Tap.Ssdt;18using NBi.Core.Etl.Execution.Jobs.Tap.Ssis;19using NBi.Core.Etl.Execution.Jobs.Tap.Ssis2012;20using NBi.Core.Etl.Execution.Jobs.Tap.Ssis2014;21using NBi.Core.Etl.Execution.Jobs.Tap.Ssis2016;22using NBi.Core.Etl.Execution.Jobs.Tap.Ssis2017;23using NBi.Core.Etl.Execution.Jobs.Tap.Ssis2019;24using NBi.Core.Etl.Execution.Jobs.Tap.Ssis2019;25using NBi.Core.Etl.Execution.Jobs.Sqoop;26using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive;27using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Hdp;28using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Hdp2;29using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Hdp3;30using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Hdp4;31using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr;32using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr2;33using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr3;34using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr4;35using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr5;36using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr6;37using NBi.Core.Etl.Execution.Jobs.Sqoop.Hive.Mr7;

Full Screen

Full Screen

GetExecutionEngineFactory

Using AI Code Generation

copy

Full Screen

1using NBi.Core.Injection;2using NBi.Core.Etl;3using NBi.Core.Etl.Execution;4using NBi.Core.Etl.Execution.Jet;5using NBi.Core.Etl.Execution.Providers;6using NBi.Core.Etl.Execution.Providers.Jet;7using NBi.Core.Etl.Execution.Providers.OleDb;8using System;9using System.Collections.Generic;10using System.Linq;11using System.Text;12using System.Threading.Tasks;13using System.Data.OleDb;14using System.Data;15using System.IO;16{17 {18 static void Main(string[] args)19 {20 var connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\sree\\Desktop\\Test\\Test.mdb;";21 var executionEngine = ServiceLocator.GetExecutionEngineFactory().Get(connectionString);22 var provider = new JetProvider(connectionString);23 var connection = provider.Open();24 var command = connection.CreateCommand();25 command.CommandText = "Select * from Test";26 var reader = command.ExecuteReader();27 DataTable dt = new DataTable();28 dt.Load(reader);29 if (dt.Rows.Count > 0)30 {31 Console.WriteLine("Success");32 }33 {34 Console.WriteLine("Failed");35 }36 Console.ReadKey();37 }38 }39}

Full Screen

Full Screen

GetExecutionEngineFactory

Using AI Code Generation

copy

Full Screen

1var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();2var engine = factory.Instantiate();3engine.Execute(testSuite);4var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();5var engine = factory.Instantiate();6engine.Execute(testSuite);7var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();8var engine = factory.Instantiate();9engine.Execute(testSuite);10var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();11var engine = factory.Instantiate();12engine.Execute(testSuite);13var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();14var engine = factory.Instantiate();15engine.Execute(testSuite);16var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();17var engine = factory.Instantiate();18engine.Execute(testSuite);

Full Screen

Full Screen

GetExecutionEngineFactory

Using AI Code Generation

copy

Full Screen

1using NBi.Core;2using NBi.Core.Injection;3using NBi.Core.Etl;4using NBi.Core.Calculation;5using NBi.Core.ResultSet;6using System;7using System.Collections.Generic;8using System.Linq;9using System.Text;10using System.Threading.Tasks;11{12 {13 static void Main(string[] args)14 {15 IEngineFactory factory = ServiceLocator.GetExecutionEngineFactory();16 IEtlRunner etlRunner = factory.InstantiateEtlRunner();17 ICalculationEngine calcEngine = factory.InstantiateCalculationEngine();18 IResultSetComparer comparer = factory.InstantiateResultSetComparer();19 Console.WriteLine("Hello World");20 Console.ReadLine();21 }22 }23}24using NBi.Core;25using NBi.Core.Injection;26using NBi.Core.Etl;27using NBi.Core.Calculation;28using NBi.Core.ResultSet;29using System;30using System.Collections.Generic;31using System.Linq;32using System.Text;33using System.Threading.Tasks;34{35 {36 static void Main(string[] args)37 {38 IEngineFactory factory = ServiceLocator.GetExecutionEngineFactory();39 IEtlRunner etlRunner = factory.InstantiateEtlRunner();40 ICalculationEngine calcEngine = factory.InstantiateCalculationEngine();41 IResultSetComparer comparer = factory.InstantiateResultSetComparer();42 Console.WriteLine("Hello World");43 Console.ReadLine();44 }45 }46}47using NBi.Core;48using NBi.Core.Injection;

Full Screen

Full Screen

GetExecutionEngineFactory

Using AI Code Generation

copy

Full Screen

1var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();2var engine = factory.Instantiate();3var suite = new NBi.NUnit.Runtime.TestSuite(engine);4suite.Add(new NBi.NUnit.Runtime.TestCase("test1", new NBi.NUnit.Runtime.TestCaseArgs()));5suite.Run();6var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();7var engine = factory.Instantiate();8var suite = new NBi.NUnit.Runtime.TestSuite(engine);9suite.Add(new NBi.NUnit.Runtime.TestCase("test2", new NBi.NUnit.Runtime.TestCaseArgs()));10suite.Run();11var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();12var engine = factory.Instantiate();13var suite = new NBi.NUnit.Runtime.TestSuite(engine);14suite.Add(new NBi.NUnit.Runtime.TestCase("test3", new NBi.NUnit.Runtime.TestCaseArgs()));15suite.Run();16var factory = NBi.Core.Injection.ServiceLocator.GetExecutionEngineFactory();17var engine = factory.Instantiate();18var suite = new NBi.NUnit.Runtime.TestSuite(engine);19suite.Add(new NBi.NUnit.Runtime.TestCase("test4", new NBi.NUnit.Runtime.TestCaseArgs()));20suite.Run();

Full Screen

Full Screen

GetExecutionEngineFactory

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.Injection;7using NBi.Core.Engine;8using NBi.Core;9using NBi.Core.Configuration;10using NBi.Core.ResultSet;11using NBi.Core.ResultSet.Comparer;12using NBi.Core.ResultSet.Resolver;13using NBi.Core.ResultSet.Lookup;14using NBi.Core.Decoration;15using NBi.Core.Decoration.DataEngineering;16using NBi.Core.Decoration.DataEngineering.Commands;17using NBi.Core.Decoration.DataEngineering.Resolver;18using NBi.Core.Decoration.DataEngineering.Resolver.Ldap;19using NBi.Core.Decoration.DataEngineering.Resolver.File;20using NBi.Core.Decoration.DataEngineering.Resolver.Csv;21using NBi.Core.Decoration.DataEngineering.Resolver.Xml;22using NBi.Core.Decoration.DataEngineering.Resolver.Json;23using NBi.Core.Decoration.DataEngineering.Resolver.Profiles;24using NBi.Core.Decoration.DataEngineering.Resolver.Lookup;25using NBi.Core.Decoration.DataEngineering.Resolver.Variables;26using NBi.Core.Decoration.DataEngineering.Resolver.Keys;27using NBi.Core.Decoration.DataEngineering.Resolver.Rs;28using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt;29using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Sql;30using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs;31using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Subscription;32using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Report;33using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Catalog;34using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Catalog.CatalogItem;35using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Catalog.CatalogItem.DataSet;36using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Catalog.CatalogItem.DataSource;37using NBi.Core.Decoration.DataEngineering.Resolver.Ssdt.Rs.Catalog.CatalogItem.DataSource.Credential;

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful