public void ServiceRegistrations_AvailableAfterSealing() { var config = new BootConfiguration(); config.Seal(); Assert.NotNull(config.ServiceRegistrations); }
public void ContainsPancakesAssembly_ByDefault() { var config = new BootConfiguration(); config.Seal(); Assert.Collection(config.Assemblies, item => Assert.NotNull(item), item => Assert.True(item.FullName.StartsWith("Pancakes"))); }
public void Sealing_MarksHasBeenSealed() { var config = new BootConfiguration(); Assert.False(config.Sealed); config.Seal(); Assert.True(config.Sealed); }
public void WillNotReaddAssemblies_AtSeal_WhenAlreadyAdded() { var config = new BootConfiguration(); config.LoadAssembly(typeof(BootConfiguration).GetTypeInfo().Assembly); config.Seal(); Assert.True(config.Assemblies.Count() == 2); }
public void ContainsEntryPointAssembly_ByDefault() { var config = new BootConfiguration(); config.Seal(); Assert.Collection(config.Assemblies, item => Assert.True(item.FullName.StartsWith("dotnet-test-xunit")), item => Assert.NotNull(item)); // we don't care about this item for this test. }
private void TestPostBootCheckWithAcion(Action <BootConfiguration> action) { var config = new BootConfiguration(); config.Seal(); var exception = Assert.Throws <ErrorCodeInvalidOperationException>(() => action(config)); Assert.Equal(CoreErrorCodes.CannotConfigurePostBoot, exception.ErrorCode); }
public void PostSealing_ContainsValidCommands() { var config = new BootConfiguration(); config.LoadAssembly(typeof(TestCommand).GetTypeInfo().Assembly); config.Seal(); Assert.True(config.Commands.Any(s => s == typeof(TestCommand))); }
public void PostSealing_ContainsValidSanityChecks() { var config = new BootConfiguration(); config.LoadAssembly(typeof(SanityCheck).GetTypeInfo().Assembly); config.Seal(); Assert.True(config.SanityChecks.Any(s => s == typeof(SanityCheck))); }
public void PostSealing_ContainsValidServiceRegistrations() { var config = new BootConfiguration(); config.LoadAssembly(typeof(TestServiceRegistration).GetTypeInfo().Assembly); config.Seal(); Assert.True(config.ServiceRegistrations.Any(sr => sr.GetType() == typeof(TestServiceRegistration))); }
public void ThrowsBootException_WhenSanityCheckFails() { var kernel = new Kernel(); var configuration = new BootConfiguration(AssemblyCollectionMockBuilder.GetWithFailingSanityCheck()); configuration.Seal(); var exception = Assert.Throws <BootException>(() => kernel.Boot(configuration)); Assert.Equal(CoreErrorCodes.InsaneKernel, exception.ErrorCode); }
public void RegistersCommandsFromBootConfiguration() { var kernel = new Kernel(); var configuration = new BootConfiguration(AssemblyCollectionMockBuilder.GetWithEasyCommand()); configuration.WithOutput(this.output.WriteLine); configuration.Seal(); kernel.Boot(configuration); var registry = kernel.ServiceLocator.GetService <ICommandRegistry>(); Assert.True(registry.IsRegistered("Test")); }