public async Task Basic() { var context = new ModuleTestContext <ObjectStorageModule>(); await context.UseHost(host => { // host.HasService<ObjectStorageService>(); }); }
public async Task Basic() { var context = new ModuleTestContext <ItemMetadataServerModule>(); await context.UseHost(host => { host.HasService <IItemMetadataDomain <ItemMetadataServer> >(); host.HasService <IItemMetadataDomain <object> >(); }); }
public async Task Test() { var context = new ModuleTestContext <TestModule>(); await context.UseHost(host => { host.HasModule <TestDepDepModule>(); host.HasModule <TestDepModule>(); }); await context.Run(); }
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); }); }
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); }); }
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); * });*/ }); }
public async Task Test() { var context = new ModuleTestContext <TestModule>().WithPlugin <TestPlugin>(); await context.Run(); }