Esempio n. 1
0
        public static IGameHostBuilder ConfigureTestServices(this IGameHostBuilder gameHostBuilder, Action <IServiceCollection> servicesConfiguration)
        {
            if (gameHostBuilder == null)
            {
                throw new ArgumentNullException(nameof(gameHostBuilder));
            }

            if (servicesConfiguration == null)
            {
                throw new ArgumentNullException(nameof(servicesConfiguration));
            }

            if (gameHostBuilder.GetType().Name.Equals("GenericGameHostBuilder"))
            {
                // Generic host doesn't need to do anything special here since there's only one container.
                gameHostBuilder.ConfigureServices(servicesConfiguration);
            }
            else
            {
                gameHostBuilder.ConfigureServices(
                    s => s.AddSingleton <IStartupConfigureServicesFilter>(
                        new ConfigureTestServicesStartupConfigureServicesFilter(servicesConfiguration)));
            }

            return(gameHostBuilder);
        }