Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        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!");
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }