public void GetsEngineService() { // Given Engine engine = new Engine(); // When IReadOnlyFileSystem fileSystem = engine.Services.GetRequiredService <IReadOnlyFileSystem>(); // Then fileSystem.ShouldBe(engine.FileSystem); }
public void GetsEngineServiceInNestedScope() { // Given Engine engine = new Engine(); IServiceScopeFactory serviceScopeFactory = engine.Services.GetRequiredService <IServiceScopeFactory>(); IServiceScope serviceScope = serviceScopeFactory.CreateScope(); // When IReadOnlyFileSystem fileSystem = serviceScope.ServiceProvider.GetRequiredService <IReadOnlyFileSystem>(); // Then fileSystem.ShouldBe(engine.FileSystem); }