public override ApplicationState Hydrate(IDictionary <string, object> aKeyValuePairs) { return(new ApplicationState { Guid = new System.Guid(aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Guid))].ToString()), Name = aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Name))].ToString(), }); }
public override RouteState Hydrate(IDictionary <string, object> aKeyValuePairs) { return(new RouteState { Guid = new System.Guid(aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Guid))].ToString()), Route = aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Route))].ToString() }); }
public void MemberNameToCamelCase_Invalid(string input) { var ex = Assert.Throws <ArgumentException>(() => CamelCase.MemberNameToCamelCase(input)); Assert.Equal("value", ex.ParamName); Assert.StartsWith($"The value '{input ?? "null"}' is not a valid member name.", ex.Message); }
public override CounterState Hydrate(IDictionary <string, object> aKeyValuePairs) { var counterState = new CounterState() { Count = Convert.ToInt32(aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Count))].ToString(), CultureInfo.InvariantCulture), Guid = new System.Guid(aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Guid))].ToString()), }; return(counterState); }
public override WeatherForecastsState Hydrate(IDictionary <string, object> aKeyValuePairs) { var newWeatherForecastsState = new WeatherForecastsState { _WeatherForecasts = Json.Deserialize <List <WeatherForecastDto> >( aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(WeatherForecasts))].ToString()), Guid = new System.Guid((string)aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Guid))]), }; return(newWeatherForecastsState); }
public override WeatherForecastsState Hydrate(IDictionary <string, object> aKeyValuePairs) { string json = aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(WeatherForecasts))].ToString(); var newWeatherForecastsState = new WeatherForecastsState() { _WeatherForecasts = JsonSerializer.Parse <List <WeatherForecastDto> >(json, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }), Guid = new System.Guid(aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Guid))].ToString()), }; return(newWeatherForecastsState); }
public override __FeatureName__State Hydrate(IDictionary <string, object> aKeyValuePairs) { string json = aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(__FeatureName__s))].ToString(); var __FeatureName__State = new __FeatureName__State() { ___FeatureName__s = JsonSerializer.Deserialize <Dictionary <Guid, __FeatureName__Dto> > ( json, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase } ), Guid = new System.Guid(aKeyValuePairs[CamelCase.MemberNameToCamelCase(nameof(Guid))].ToString()), }; return(__FeatureName__State); }
public void MemberNameToCamelCase_Valid(string input, string expectedOutput) { Assert.Equal(expectedOutput, CamelCase.MemberNameToCamelCase(input)); }