예제 #1
0
        public void TestFixtureTearDown()
        {
            _serviceTester?.Dispose();

            //Environment.SetEnvironmentVariable("ZONE", null);
            //Environment.SetEnvironmentVariable("ENV", null);
        }
예제 #2
0
        public async Task RunInConfigurationVerification_ShouldWriteResults()
        {
            NonOrleansServiceTester <CalculatorServiceHost> serviceTester = null;
            var testingKernel = new TestingKernel <ConsoleLog>();

            try
            {
                var buffer = new StringBuilder();
                var prOut  = Console.Out;
                Console.SetOut(new StringWriter(buffer));

                serviceTester = testingKernel.GetServiceTesterForNonOrleansService <CalculatorServiceHost>(
                    1112,
                    TimeSpan.FromSeconds(10),
                    ServiceStartupMode.VerifyConfigurations);

                var canaryType = typeof(MetricsConfiguration);

                Console.SetOut(prOut);

                Regex.IsMatch(buffer.ToString(), $"(OK|ERROR).*{canaryType.FullName}")
                .ShouldBeTrue("Output should contain a row with validation of the type");

                Console.WriteLine(buffer);
            }
            finally
            {
                Should.Throw <InvalidOperationException>(() => serviceTester?.Dispose())
                .Message.ShouldContain("Service is already stopped");
                testingKernel.Dispose();
            }
        }
 public virtual void TearDown()
 {
     try
     {
         _testinghost.Dispose();
         //   Metric.ShutdownContext("Service");
     }
     catch
     {
         //should not fail tests
     }
 }
예제 #4
0
        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();
            }
        }
예제 #5
0
 public void TestFixtureTearDown()
 {
     _serviceTester?.Dispose();
 }