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"); }
public void ThenTheResultShouldHaveValues(string value, string time, string nullableTime, string culture, ExampleEnum someEnum) { PocObject poc = this.scenarioContext.Get <PocObject>("Result"); var expected = 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 }; Assert.AreEqual(expected, poc); }