public virtual void SetUp() { _testinghost = new NonOrleansServiceTester <TestingHost <IDemoService> >(); _insecureClient = _testinghost.GetServiceProxy <IDemoService>(); Metric.ShutdownContext("Service"); TracingContext.SetRequestID("1"); }
public void TestFixtureSetUp() { _serviceTester = new NonOrleansServiceTester <CalculatorServiceHost>(); _serviceProxy = _serviceTester.GetServiceProxy <ICalculatorService>(); _flumeQueue = (SpyEventPublisher)_serviceTester.Host.Kernel.Get <IEventPublisher>(); }
public void TestFixtureSetUp() { _serviceTester = new NonOrleansServiceTester <CalculatorServiceHost>(); _serviceTester.CommunicationKernel.Rebind <ICertificateLocator>().To <DummyCertificateLocator>(); _serviceProxy = _serviceTester.GetServiceProxy <ICalculatorService>(); _flumeQueue = (SpyEventPublisher)_serviceTester.Host.Kernel.Get <IEventPublisher>(); }
public async Task CallService_ClientHttpsConfiguration_ShouldSucceed(bool httpsEnabledInClient) { var testingHost = new NonOrleansServiceTester <SlowServiceHost>(); if (!httpsEnabledInClient) { testingHost.CommunicationKernel.DisableHttps(); } var client = testingHost.GetServiceProxy <ISlowService>(); await client.SimpleSlowMethod(1, 2); }
public void TestMetricsOnSuccess() { using (var testinghost = new NonOrleansServiceTester <TestingHost <IDemoService> >()) { testinghost.Host.Instance.Increment(0).Returns((ulong)1); var res = testinghost.GetServiceProxy <IDemoService>().Increment(0).Result; res.Should().Be(1); testinghost.Host.Instance.Received().Increment(0); Thread.Sleep(100); GetMetricsData(testinghost.Host.ServiceName).AssertEquals(DefaultExpected()); } }
public async Task ShouldCallSelfHostServcie() { NonOrleansServiceTester <CalculatorServiceHost> serviceTester = null; var testingKernel = new TestingKernel <TraceLog>(); try { serviceTester = testingKernel.GetServiceTesterForNonOrleansService <CalculatorServiceHost>(1111, TimeSpan.FromSeconds(10)); (await serviceTester.GetServiceProxy <ICalculatorService>().Add(1, 2)).ShouldBe(3); } finally { serviceTester?.Dispose(); testingKernel.Dispose(); } }
public void TestFixtureSetUp() { //Environment.SetEnvironmentVariable("ZONE", "zone"); //Environment.SetEnvironmentVariable("ENV", "env"); var config = new HostEnvironment(new TestHostEnvironmentSource( zone: "zone", deploymentEnvironment: "env", appName: "ICalculatorService")); _serviceTester = new NonOrleansServiceTester <CalculatorServiceHost>(); _serviceTester.CommunicationKernel.Rebind <ICertificateLocator>().To <DummyCertificateLocator>(); _serviceProxy = _serviceTester.GetServiceProxy <ICalculatorService>(); _flumeQueue = (SpyEventPublisher)_serviceTester.Host.Kernel.Get <IEventPublisher>(); }
public void TestMetricsOnFailure() { using (var testinghost = new NonOrleansServiceTester <TestingHost <IDemoService> >()) { testinghost.Host.Instance.When(a => a.DoSomething()).Do(x => { throw new Exception("Do exception"); }); Assert.Throws <RemoteServiceException>(() => testinghost.GetServiceProxy <IDemoService>().DoSomething().GetAwaiter().GetResult()); var metricsExpected = DefaultExpected(); metricsExpected.Counters = new List <MetricDataEquatable> { new MetricDataEquatable { Name = "Failed", Unit = Unit.Calls } }; GetMetricsData(testinghost.Host.ServiceName).AssertEquals(metricsExpected); } }