예제 #1
0
 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(),
     });
 }
예제 #2
0
 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()
     });
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
 public void MemberNameToCamelCase_Valid(string input, string expectedOutput)
 {
     Assert.Equal(expectedOutput, CamelCase.MemberNameToCamelCase(input));
 }