public void GivenISerializeThePropertyBag() { IJsonSerializerOptionsProvider settingsProvider = ContainerBindings.GetServiceProvider(this.featureContext).GetService <IJsonSerializerOptionsProvider>(); PropertyBag propertyBag = this.scenarioContext.Get <PropertyBag>(); this.scenarioContext.Set(JsonSerializer.Serialize(propertyBag, settingsProvider.Instance), "Result"); }
public void GivenISerializeAPOCOWith(string value, string time, string nullableTime, string culture, ExampleEnum someEnum) { var poco = new PocObject { SomeCulture = string.IsNullOrEmpty(culture) ? null : CultureInfo.GetCultureInfo(culture), SomeDateTime = DateTimeOffset.Parse(time), SomeNullableDateTime = string.IsNullOrEmpty(nullableTime) ? null : (DateTimeOffset?)DateTimeOffset.Parse(nullableTime), SomeEnum = someEnum, SomeValue = value }; IJsonSerializerOptionsProvider settingsProvider = ContainerBindings.GetServiceProvider(this.featureContext).GetService <IJsonSerializerOptionsProvider>(); this.scenarioContext.Set(JsonSerializer.Serialize(poco, settingsProvider.Instance), "Result"); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyBag"/> class. /// </summary> /// <param name="serializerOptionsProvider">The serializer settings provider.</param> public PropertyBag(IJsonSerializerOptionsProvider serializerOptionsProvider) { if (serializerOptionsProvider is null) { throw new ArgumentNullException(nameof(serializerOptionsProvider)); } this.Properties = EmptyObject; this.SerializerOptions = serializerOptionsProvider.Instance; }
public JsonSerializer(IJsonSerializerOptionsProvider jsonSerializerOptionsProvider) { _jsonSerializerOptions = jsonSerializerOptionsProvider.Apply(new JsonSerializerOptions()); }
protected BaseStartup(IConfiguration configuration) { Configuration = configuration; JsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(); }
public void GivenIDeserializeAPropertyBagFromTheStringHelloWorldNumber(string json) { IJsonSerializerOptionsProvider settingsProvider = ContainerBindings.GetServiceProvider(this.featureContext).GetService <IJsonSerializerOptionsProvider>(); this.scenarioContext.Set(JsonSerializer.Deserialize <PropertyBag>(json, settingsProvider.Instance), "Result"); }
public void GivenIDeserializeAPOCOWithTheJsonString(string json) { IJsonSerializerOptionsProvider settingsProvider = ContainerBindings.GetServiceProvider(this.featureContext).GetService <IJsonSerializerOptionsProvider>(); this.scenarioContext.Set(JsonSerializer.Deserialize <PocObject>(json, settingsProvider.Instance), "Result"); }