/// <summary> /// Special configuration for Testing with the Test Server /// </summary> /// <param name="aServiceCollection"></param> private void ConfigureServices(IServiceCollection aServiceCollection) { aServiceCollection.AddSingleton <AmountConverter>(); aServiceCollection.AddSingleton(BlazorStateTestServer.CreateClient()); aServiceCollection.AddBlazorState ( aOptions => aOptions.Assemblies = new Assembly[] { typeof(Startup).GetTypeInfo().Assembly } ); aServiceCollection.AddSingleton ( new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase } ); aServiceCollection.AddSingleton <AddressUtil>(); aServiceCollection.AddScoped(typeof(IValidator <SendAction>), typeof(SendValidator)); // Add States aServiceCollection.AddTransient <ApplicationState>(); aServiceCollection.AddTransient <EdgeState>(); aServiceCollection.AddTransient <EdgeAccountState>(); aServiceCollection.AddTransient <EdgeCurrencyWalletsState>(); }
public FetchWeatherForecastTests( TestFixture aTestFixture, BlazorStateTestServer aBlazorStateTestServer) { ServiceProvider = aTestFixture.ServiceProvider; Mediator = ServiceProvider.GetService <IMediator>(); Store = ServiceProvider.GetService <IStore>(); WeatherForecastsState = Store.GetState <WeatherForecastsState>(); }
public TestFixture(BlazorStateTestServer aBlazorStateTestServer) { BlazorStateTestServer = aBlazorStateTestServer; IWebAssemblyHostBuilder webAssemblyHostBuilder = BlazorWebAssemblyHost.CreateDefaultBuilder() //.UseBlazorStartup<Startup>() .ConfigureServices(ConfigureServices); ServiceProvider = webAssemblyHostBuilder.Build().Services; }
public TestFixture(BlazorStateTestServer aBlazorStateTestServer) { BlazorStateTestServer = aBlazorStateTestServer; WebAssemblyHostBuilder = BlazorWebAssemblyHost.CreateDefaultBuilder() .ConfigureServices(ConfigureServices); }