Пример #1
0
 public async Task Basic()
 {
     var context = new ModuleTestContext <ObjectStorageModule>();
     await context.UseHost(host =>
     {
         // host.HasService<ObjectStorageService>();
     });
 }
Пример #2
0
 public async Task Basic()
 {
     var context = new ModuleTestContext <ItemMetadataServerModule>();
     await context.UseHost(host =>
     {
         host.HasService <IItemMetadataDomain <ItemMetadataServer> >();
         host.HasService <IItemMetadataDomain <object> >();
     });
 }
Пример #3
0
        public async Task Test()
        {
            var context = new ModuleTestContext <TestModule>();
            await context.UseHost(host =>
            {
                host.HasModule <TestDepDepModule>();
                host.HasModule <TestDepModule>();
            });

            await context.Run();
        }
Пример #4
0
 public async Task Test()
 {
     var context = new ModuleTestContext <TestModule>();
     await context.UseHost(host =>
     {
         var module = host.EnsureGetService <TestModule>();
         Assert.AreEqual(TestModule.ManifestString, module.Manifest.Author);
         Assert.AreEqual(TestModule.ManifestString, module.Manifest.Description);
         Assert.AreEqual(TestModule.ManifestString, module.Manifest.DisplayName);
         Assert.AreEqual(TestModule.ManifestString, module.Manifest.Url);
         Assert.AreEqual(TestModule.ManifestString, module.Manifest.Version);
         Assert.AreEqual(TestModule.ManifestString, module.Manifest.Name);
     });
 }
Пример #5
0
        public async Task Test()
        {
            var context = new ModuleTestContext <TestModule>();
            await context.UseHost(host =>
            {
                var module = host.EnsureGetService <TestModule>();
                Assert.IsFalse(module.HasInitialized);
                Assert.IsFalse(module.HasShutdowned);
            });

            await context.Run(host =>
            {
                var module = host.EnsureGetLoadedModule <TestModule>();
                Assert.IsTrue(module.HasInitialized);
                Assert.IsFalse(module.HasShutdowned);
            });
        }
Пример #6
0
        public async Task Test()
        {
            var context = new ModuleTestContext <TestModule>();
            await context.Run(host =>
            {
                var module = host.EnsureGetLoadedModule <TestModule>();

                // TODO: Fix get service, move them to extension methods

                /*module.GetService<TestSingletonModuleService>(host.Services);
                 * using var scope = host.Services.CreateScope();
                 * module.GetService<TestDirectModuleService>(scope.ServiceProvider);
                 * module.GetService<ITestInnerModuleService>(scope.ServiceProvider);
                 * Assert.ThrowsException<Exception>(() =>
                 * {
                 *  module.GetService<TestInnerModuleService>(scope.ServiceProvider);
                 * });
                 * module.GetOption<TestModuleOption>(scope.ServiceProvider);
                 * Assert.ThrowsException<Exception>(() =>
                 * {
                 *  module.GetOption<TestUndefModuleOption>(scope.ServiceProvider);
                 * });*/
            });
        }
Пример #7
0
 public async Task Test()
 {
     var context = new ModuleTestContext <TestModule>().WithPlugin <TestPlugin>();
     await context.Run();
 }