public void ItShouldFindTestModule() { ImmutableArray <OrderedModuleRegistration> registrations = ModuleExtensions.GetModules( new[] { GetType().Assembly }, Array.Empty <Type>(), new NoConfiguration()); Assert.NotEmpty(registrations); Assert.Contains( registrations, orderedModuleRegistration => orderedModuleRegistration.ModuleRegistration.ModuleType == typeof(TestModule)); }
public void ShouldBeFound() { ImmutableArray <OrderedModuleRegistration> registrations = ModuleExtensions.GetModules( new[] { GetType().Assembly }, Array.Empty <Type>(), new NoConfiguration()); OrderedModuleRegistration orderedModuleRegistration = registrations.SingleOrDefault(moduleRegistration => moduleRegistration.ModuleRegistration.ModuleType == typeof(SimpleNoOpTestModule)); Assert.NotNull(orderedModuleRegistration); }
public void ShouldRegisterInRootScopeFalse() { ImmutableArray <OrderedModuleRegistration> registrations = ModuleExtensions.GetModules( new[] { GetType().Assembly }, Array.Empty <Type>(), new NoConfiguration()); OrderedModuleRegistration orderedModuleRegistration = registrations.SingleOrDefault(moduleRegistration => moduleRegistration.ModuleRegistration.ModuleType == typeof(SimpleNoOpTestModule)); Assert.False(orderedModuleRegistration?.ModuleRegistration?.RegisterInRootScope); }
public void ShouldBeFound() { ImmutableArray <OrderedModuleRegistration> registrations = ModuleExtensions.GetModules( new[] { GetType().Assembly }, Array.Empty <Type>(), new NoConfiguration()); OrderedModuleRegistration orderedModuleRegistration = registrations.SingleOrDefault(moduleRegistration => moduleRegistration.ModuleRegistration.ModuleType == typeof(NoOpTestModule)); Assert.Equal(37, orderedModuleRegistration?.ModuleRegistration?.Order); Assert.Equal(Scope.AspNetCoreScope, orderedModuleRegistration?.ModuleRegistration?.Tag); Assert.True(orderedModuleRegistration?.ModuleRegistration?.RegisterInRootScope); }
public void ItShouldInstantiateModule() { var nameValueCollection = new NameValueCollection { { nameof(NoOpTestModule.MeaningOfLife), "42" } }; ImmutableArray <OrderedModuleRegistration> registrations = ModuleExtensions.GetModules( new[] { GetType().Assembly }, Array.Empty <Type>(), new InMemoryKeyValueConfiguration(nameValueCollection)); OrderedModuleRegistration orderedModuleRegistration = registrations.SingleOrDefault(moduleRegistration => moduleRegistration.ModuleRegistration.ModuleType == typeof(NoOpTestModule)); Assert.NotNull(orderedModuleRegistration); var module = orderedModuleRegistration.Module as NoOpTestModule; Assert.NotNull(module); Assert.Equal("42", module.MeaningOfLife); }