public void ShouldLoadStatesFromJson() { //Arrange string jsonString = File.ReadAllText("./Store/Store.json"); //Act ReduxDevToolsStore.LoadStatesFromJson(jsonString); // Assert ApplicationState applicationState = Store.GetState <ApplicationState>(); applicationState.Name.ShouldBe("Blazor State Demo Application"); applicationState.Guid.ToString().ShouldBe("5a2efcec-6297-4254-a2dc-30e4e567e549"); CounterState counterState = Store.GetState <CounterState>(); counterState.Count.ShouldBe(18); counterState.Guid.ToString().ShouldBe("a0d74c63-13f4-4a2f-b18b-9a1fdaa397b2"); WeatherForecastsState weatherForecastsState = Store.GetState <WeatherForecastsState>(); weatherForecastsState.WeatherForecasts.Count.ShouldBe(5); weatherForecastsState.WeatherForecasts[0].Summary.ShouldBe("Freezing"); weatherForecastsState.WeatherForecasts[0].TemperatureC.ShouldBe(16); weatherForecastsState.WeatherForecasts[0].TemperatureF.ShouldBe(60); weatherForecastsState.WeatherForecasts[0].Date.Year.ShouldBe(2018); weatherForecastsState.WeatherForecasts[0].Date.Month.ShouldBe(8); weatherForecastsState.WeatherForecasts[0].Date.Day.ShouldBe(26); weatherForecastsState.WeatherForecasts[0].Date.Hour.ShouldBe(9); weatherForecastsState.WeatherForecasts[0].Date.Minute.ShouldBe(29); weatherForecastsState.WeatherForecasts[0].Date.Second.ShouldBe(54); }
public WeatherForecastStateCloneTests(TestFixture aTestFixture) { IServiceProvider serviceProvider = aTestFixture.ServiceProvider; IStore store = serviceProvider.GetService <IStore>(); WeatherForecastsState = store.GetState <WeatherForecastsState>(); }
public FetchWeatherForecastTests(TestFixture aTestFixture) { ServiceProvider = aTestFixture.ServiceProvider; Mediator = ServiceProvider.GetService <IMediator>(); Store = ServiceProvider.GetService <IStore>(); WeatherForecastsState = Store.GetState <WeatherForecastsState>(); }
public async Task Should_Fetch_WeatherForecasts() { var fetchWeatherForecastsRequest = new FetchWeatherForecastsAction(); WeatherForecastsState = await Mediator.Send(fetchWeatherForecastsRequest); WeatherForecastsState.WeatherForecasts.Count.ShouldBeGreaterThan(0); }
public async Task Should_Fetch_WeatherForecasts() { // Default WeatherForecastsState is an empty list. So no need to initialize it. var fetchWeatherForecastsRequest = new FetchWeatherForecastsAction(); WeatherForecastsState = await Mediator.Send(fetchWeatherForecastsRequest); WeatherForecastsState.WeatherForecasts.Count.ShouldBeGreaterThan(0); }
public async Task Should_Fetch_WeatherForecasts() { // Default WeatherForecastsState is an empty list. So no need to initialize it. // We need the server running to respond. // In Memory one hopefully works here with blazor. // will need a way to provide it the WebClient to use. var fetchWeatherForecastsRequest = new FetchWeatherForecastsRequest(); WeatherForecastsState = await Mediator.Send(fetchWeatherForecastsRequest); WeatherForecastsState.WeatherForecasts.Count.ShouldBeGreaterThan(0); }
/// <summary> /// WeatherForecatesState will throw an exception if items initialized in the constructor are null. /// </summary> public void ShouldInitializeStateAfterConstruction() { WeatherForecastsState state = Store.GetState <WeatherForecastsState>(); state.ShouldNotBeNull(); }