public void SelfHostServiceClientTest() { eventListener.LogToConsole(); eventListener.EnableEvents(DefaultEventSource.Log, EventLevel.Verbose); //eventListener.EnableEvents(null, EventLevel.Verbose) //eventListener.Subscribe((a)=> a var loggerFact = DurableTaskMicroservices.Common.Test.UnitTestLogging.GetDebugLoggerFactory(); List <OrchestrationState> runningInstances; ServiceHost host = HostHelpersExtensions.CreateMicroserviceHost(ServiceBusConnectionString, StorageConnectionString, nameof(SelfHostServiceClientTest), true, out runningInstances, loggerFact); var microservices = host.StartServiceHostAsync(Path.Combine(), runningInstances: runningInstances, context: new Dictionary <string, object>() { { "company", "daenet" } }).Result; // var r = new Daenet.Microservice() { }; //xmlSerializeService(typeof(Daenet.DurableTaskMicroservices.UnitTests.CounterOrchestration), "aaa.xml"); ServiceClient client = ClientHelperExtensions.CreateMicroserviceClient(ServiceBusConnectionString, StorageConnectionString, nameof(SelfHostServiceClientTest)); var svc = client.StartServiceAsync(cHelloWorlSvcName, new HelloWorldOrchestrationInput { HelloText = "SelfHostServiceClientTestInputArg" }).Result; microservices.Add(svc); host.WaitOnInstances(host, microservices); }
public void SelfHostServiceClientTestWithHubName() { var loggerFact = DurableTaskMicroservices.Common.Test.UnitTestLogging.GetDebugLoggerFactory(); ServiceClient client = ClientHelperExtensions.CreateMicroserviceClient(ServiceBusConnectionString, StorageConnectionString, nameof(SelfHostServiceClientTest)); var orchestrationInput = new HelloWorldOrchestrationInput { HelloText = "SelfHostServiceClientTestInputArg", Context = new Dictionary <string, object> { { "ActivityId", "SelfHostServiceClientTestWithHubName" } } }; var svc = client.StartServiceAsync(cHelloWorlSvcName, orchestrationInput).Result; Assert.IsTrue(svc != null); }
public void SelfHostServiceClientTest() { var loggerFact = getSqlLoggerFactory(); List <OrchestrationState> runningInstances; ServiceHost host = HostHelpersExtensions.CreateMicroserviceHost(ServiceBusConnectionString, SqlStorageConnectionString, nameof(SelfHostServiceClientTest), true, out runningInstances, loggerFact); int errCnt = 0; // // This method subscribes all errors, which happen internally on host. host.SubscribeEvents(EventLevel.LogAlways, (msg) => { Debug.WriteLine(msg); if (msg.Contains("Error converting value \"invalid input\" to type")) { errCnt++; } }, "errors"); var microservices = host.StartServiceHostAsync(Path.Combine(), runningInstances: runningInstances, context: new Dictionary <string, object>() { { "company", "daenet" } }).Result; ServiceClient client = ClientHelperExtensions.CreateMicroserviceClient(ServiceBusConnectionString, SqlStorageConnectionString, nameof(SelfHostServiceClientTest)); //string svcName = "Daenet.Microservice.Common.Test.HelloWorldOrchestration.HelloWorldOrchestration"; // Daenet.DurableTaskMicroservices.Common.Test.HelloWorldOrchestration var svc = client.StartServiceAsync(UnitTestsServiceClient.cHelloWorlSvcName, new HelloWorldOrchestration.HelloWorldOrchestrationInput { HelloText = "SelfHostServiceClientTestInputArg" }).Result; microservices.Add(svc); host.WaitOnInstances(host, microservices); }