public void Features_can_add_array_properties_to_serialized_RunResult_by_implementing_IAugmentRunResult() { var result = new RunResult(true); result.AddFeature(new TestFeature <string[]>("array", new[] { "one", "two", "three" })); var json = result.ToJson().FromJsonTo <JObject>(); var array = json.Property("array").Value.ToObject <string[]>(); array.Should().Equal("one", "two", "three"); }
public void Features_can_add_string_properties_to_serialized_RunResult_by_implementing_IAugmentRunResult() { var result = new RunResult(true); result.AddFeature(new TestFeature <string>("string", "here i am!")); var json = result.ToJson().FromJsonTo <dynamic>(); var scalar = (string)json.@string; scalar.Should().Be("here i am!"); }
public void Features_can_add_int_properties_to_serialized_RunResult_by_implementing_IAugmentRunResult() { var result = new RunResult(true); result.AddFeature(new TestFeature <int>("int", 123)); var json = result.ToJson().FromJsonTo <dynamic>(); var scalar = (int)json.@int; scalar.Should().Be(123); }
public void Features_can_add_object_properties_to_serialized_RunResult_by_implementing_IAugmentRunResult() { var result = new RunResult(true); result.AddFeature(new TestFeature <TestClass>("object", new TestClass("a", 1))); var json = result.ToJson(); var obj = json.FromJsonTo <JObject>().Property("object").Value.ToObject <TestClass>(); obj.StringProperty.Should().Be("a"); obj.IntProperty.Should().Be(1); }