public void ShouldMap_JObject_To_StringValue_From_Null()
    {
        var item = new JObjectA
        {
            Bar = null
        };
        var result = Mapper.Map <StringValue>(item);

        result.Bar.Should().BeNull();
    }
    public void ShouldMap_JObject_To_ByteArray_From_Null()
    {
        var item = new JObjectA
        {
            Bar = null
        };
        var result = Mapper.Map <ByteArray>(item);

        result.Bar.Should().BeNull();
    }
예제 #3
0
    public void ShouldMap_From_JObject_To_JsonElement(string json, JsonValueKind kind)
    {
        var item = new JObjectA()
        {
            Bar = JObject.Parse(json)
        };
        var result = Mapper.Map <JsonElementB>(item);

        result.Bar.ValueKind.Should().Be(kind);
    }
예제 #4
0
    public void ShouldMap_From_JObject_To_JsonElement_Null_Allow_Nulls()
    {
        var item = new JObjectA()
        {
            Bar = null
        };
        var result = Mapper.Map <JsonElementB>(item);

        result.Bar.ValueKind.Should().Be(JsonValueKind.Undefined);
    }
예제 #5
0
    public void ShouldMap_From_JObject_To_Nullable_JsonElement_Null_Allow_Nulls()
    {
        var item = new JObjectA()
        {
            Bar = null
        };
        var result = Mapper.Map <JsonElementA>(item);

        result.Bar.Should().BeNull();
    }
        public void ShouldMap_JObject_To_JObject_From_Null()
        {
            var item = new JObjectA()
            {
                Bar = null
            };
            var result = Mapper.Map <JObjectA>(item);

            result.Bar.Should().BeNull();
        }
    public void ShouldMap_JObject_To_StringValue_With_Content()
    {
        var item = new JObjectA
        {
            Bar = JObject.Parse("{\"a\": \"123\"}")
        };
        var result = Mapper.Map <StringValue>(item);

        result.Bar.Should().NotBeNull();
        result.Bar.Should().Be("{\"a\":\"123\"}");
    }
    public void ShouldMap_JObject_To_StringValue()
    {
        var item = new JObjectA
        {
            Bar = new JObject()
        };
        var result = Mapper.Map <StringValue>(item);

        result.Bar.Should().NotBeNull();
        result.Bar.Should().Be("{}");
    }
    public void ShouldMap_JObject_To_JObject()
    {
        var item = new JObjectA
        {
            Bar = JObject.Parse("{}")
        };
        var result = Mapper.Map <JObjectA>(item);

        result.Bar.Should().NotBeNull();
        result.Bar.Should().BeEmpty();
    }
    public void ShouldMap_JObject_To_ByteArray_With_Content()
    {
        var item = new JObjectA
        {
            Bar = JObject.Parse("{\"a\": \"123\"}")
        };
        var result = Mapper.Map <ByteArray>(item);

        result.Bar.Should().NotBeNull();
        Encoding.UTF8.GetString(result.Bar !).Should().Be("{\"a\":\"123\"}");
    }
    public void ShouldMap_JObject_To_ByteArray()
    {
        var item = new JObjectA
        {
            Bar = new JObject()
        };
        var result = Mapper.Map <ByteArray>(item);

        result.Bar.Should().NotBeNull();
        Encoding.UTF8.GetString(result.Bar !).Should().Be("{}");
    }
예제 #12
0
        public void ShouldMap_From_JObject_To_Nullable_JsonElement_Null()
        {
            var item = new JObjectA()
            {
                Bar = null
            };
            var result = Mapper.Map <JsonElementA>(item);

            result.Bar.Should().NotBeNull();
            result.Bar.Value.ValueKind.Should().Be(JsonValueKind.Undefined);
        }
    public void ShouldMap_JObject_To_JObject_With_Content()
    {
        var item = new JObjectA()
        {
            Bar = JObject.Parse("{\"a\": \"123\"}")
        };
        var result = Mapper.Map <JObjectA>(item);

        result.Bar.Should().NotBeNull();
        result.Bar.Should().NotBeEmpty();
    }
    public void ShouldMap_From_JObject_To_Nullable_JsonElement(string json, JsonValueKind kind)
    {
        var item = new JObjectA
        {
            Bar = JObject.Parse(json)
        };
        var result = Mapper.Map <JsonElementA>(item);

        result.Bar.Should().NotBeNull();
        result.Bar !.Value.ValueKind.Should().Be(kind);
    }