Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            TestSingletonService testSingletonService = new TestSingletonService();

            Program.ServiceProviderRoot = new ServiceCollection()
                                          .AddTransient <IMyTransientService, MyTransientService>()
                                          .AddSingleton <IMySingletonService, MySingletonService>()
                                          .AddScoped <IMyScopedService, MyScopedOtherService>()
                                          .AddScoped <IMyScopedService, MyScopedService>()
                                          .AddSingleton(testSingletonService)
                                          .BuildServiceProvider();

            while (true)
            {
                Console.WriteLine($"\r\n请输入测试用例编号:{TestFactory.Selections.AsFormatJsonStr()}");
                string num = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(num))
                {
                    continue;
                }

                ITest test = TestFactory.Create(num);
                test.Run();
            }
        }
Example #2
0
 public TestActor(ActorHost host, TestSingletonService singletonService, TestScopedService scopedService)
     : base(host)
 {
     this.SingletonService = singletonService;
     this.ScopedService    = scopedService;
 }