public void InitializeEnvironment()
        {
            var serviceCollection = new ServiceCollection() as IServiceCollection;

            // misc services for resolving data
            serviceCollection.AddScoped <IMusicService, MusicService>();
            serviceCollection.AddSingleton <IMusicRepository, MusicRepository>();

            // schema setup
            Action <SchemaOptions> configureOptions = (SchemaOptions options) =>
            {
                options.AddGraphType <Artist>();
                options.AddGraphType <MusicGenre>();
                options.AddGraphType <Record>();
                options.AddGraphType <RecordCompany>();
                options.AddGraphType <MusicController>();
            };

            var injector = new GraphQLSchemaInjector <GraphSchema>(serviceCollection, configureOptions);

            injector.ConfigureServices();

            _serviceProvider = serviceCollection.BuildServiceProvider();
            injector.UseSchema(_serviceProvider);
        }
        /// <summary>
        /// Creates a new test server instance from the current settings in this builder.
        /// </summary>
        /// <returns>TestServer.</returns>
        public TestServer <TSchema> Build()
        {
            var serviceCollection = new ServiceCollection();

            foreach (var descriptor in this.ServiceCollection)
            {
                serviceCollection.Insert(serviceCollection.Count, descriptor);
            }

            // any additional, 1 off services added to the builder?
            foreach (var service in this)
            {
                serviceCollection.AddOrUpdate(service);
            }

            // register all test components
            foreach (var component in _testComponents)
            {
                component.Inject(serviceCollection);
            }

            var userProvidedConfigOptions = _configureOptions;

            _configureOptions = (options) =>
            {
                this.PerformInitialConfiguration(options);
                foreach (var type in _additionalTypes)
                {
                    options.AddGraphType(type);
                }

                userProvidedConfigOptions?.Invoke(options);
            };

            // inject staged graph types
            var injector = new GraphQLSchemaInjector <TSchema>(serviceCollection, _configureOptions);

            injector.ConfigureServices();

            foreach (var action in _schemaBuilderAdditions)
            {
                action.Invoke(injector.SchemaBuilder);
            }

            var userAccount     = this.User.CreateUserAccount();
            var serviceProvider = serviceCollection.BuildServiceProvider();

            injector.UseSchema(serviceProvider);

            return(new TestServer <TSchema>(serviceProvider, userAccount));
        }