Ejemplo n.º 1
0
    public async Task NullString()
    {
        var target = new ClassWithString();
        var result = await RoundTrip.Run(target);

        Assert.Null(result.Property);
    }
Ejemplo n.º 2
0
    public async Task Guid()
    {
        var target = new ClassWithGuid
        {
            Property = new("45b14050-065c-4be7-8bb8-f3b46b8d94e6")
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("45b14050-065c-4be7-8bb8-f3b46b8d94e6", result.Property.ToString());
    }
    public void ByteArray()
    {
        var target = new ClassWithByteArray
        {
            Property = new byte[] { 2, 3 }
        };
        var result = RoundTrip.Run(target);

        CollectionAssert.AreEqual(new byte[] { 2, 3 }, result.Property);
    }
Ejemplo n.º 4
0
    public async Task EmptyString()
    {
        var target = new ClassWithString
        {
            Property = string.Empty
        };
        var result = await RoundTrip.Run(target);

        Assert.Empty(result.Property);
    }
    public void String()
    {
        var target = new ClassWithString
        {
            Property = "Foo"
        };
        var result = RoundTrip.Run(target);

        Assert.AreEqual("Foo", result.Property);
    }
Ejemplo n.º 6
0
    public async Task String()
    {
        var target = new ClassWithString
        {
            Property = "Foo"
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("Foo", result.Property);
    }
Ejemplo n.º 7
0
    public async Task ByteArray()
    {
        var target = new ClassWithByteArray
        {
            Property = new byte[] { 2, 3 }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal(new byte[] { 2, 3 }, result.Property);
    }
Ejemplo n.º 8
0
    public void NodeWithConverter()
    {
        var target = new WithConverterTargetClass
        {
            Property = "AbCd"
        };
        var result = RoundTrip.Run(target);

        Assert.Equal("AbCd", result.Property);
        ReverseConverter.AssertReadWriteCalled();
    }
    public async Task WithConstructorEnumerableParameter()
    {
        var target = new ClassWithConstructorEnumerableParameter(
            new List <Guid>
        {
            new Guid("45b14050-065c-4be7-8bb8-f3b46b8d94e6"),
            new Guid("74b69ad1-f9e8-4549-8524-cce4a8b4c38b")
        });

        var result = await RoundTrip.Run(target);

        Assert.Equal("74b69ad1-f9e8-4549-8524-cce4a8b4c38b", result.Property.Last().ToString());
    }
    public async Task StringList()
    {
        var target = new ClassWithStringList
        {
            Property = new List <string>
            {
                "Value1",
                "Value2"
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("Value2", result.Property?[1]);
    }
    public void StringCollection()
    {
        var target = new ClassWithStringCollection
        {
            Property = new List <string>
            {
                "Value1",
                "Value2"
            }
        };
        var result = RoundTrip.Run(target);

        Assert.AreEqual("Value2", result.Property.Last());
    }
    public async Task ByteArrayList()
    {
        var target = new ClassWithByteArrayList
        {
            Property = new()
            {
                new byte[] { 2, 3 },
                new byte[] { 5, 6 }
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal(new byte[] { 5, 6 }, result.Property?[1]);
    }
    public async Task Node()
    {
        var target = new TargetClass
        {
            SubProperty = new()
            {
                Property1 = "PropertyValue1",
                Property2 = "PropertyValue2"
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("PropertyValue1", result.SubProperty?.Property1);
    }
    public void StringEnumerable()
    {
        var target = new ClassWithStringEnumerable
        {
            Property = new List <string>
            {
                "Value1",
                "Value2"
            }
        };
        var result = RoundTrip.Run(target);

        Assert.Equal("Value2", result.Property.Last());
    }
    public void GuidEnumerable()
    {
        var target = new ClassWithGuidEnumerable
        {
            Property = new List <Guid>
            {
                new Guid("45b14050-065c-4be7-8bb8-f3b46b8d94e6"),
                new Guid("74b69ad1-f9e8-4549-8524-cce4a8b4c38b")
            }
        };
        var result = RoundTrip.Run(target);

        Assert.Equal("74b69ad1-f9e8-4549-8524-cce4a8b4c38b", result.Property.Last().ToString());
    }
    public void ByteArrayList()
    {
        var target = new ClassWithByteArrayList
        {
            Property = new List <byte[]>
            {
                new byte[] { 2, 3 },
                new byte[] { 5, 6 }
            }
        };
        var result = RoundTrip.Run(target);

        Assert.Equal(new byte[] { 5, 6 }, result.Property[1]);
    }
Ejemplo n.º 17
0
    public void Node()
    {
        var target = new TargetClass
        {
            SubProperty = new SubClass
            {
                Property1 = "PropertyValue1",
                Property2 = "PropertyValue2"
            }
        };
        var result = RoundTrip.Run(target);

        Assert.Equal("PropertyValue1", result.SubProperty.Property1);
    }
    public async Task StringDictionary()
    {
        var target = new ClassWithStringDictionary
        {
            Property = new Dictionary <string, string>
            {
                {
                    "Key1", "Value1"
                },
                {
                    "Key2", "Value2"
                }
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("Value2", result.Property?["Key2"]);
    }
    public void ByteArrayDictionary()
    {
        var target = new ClassWithByteArrayDictionary
        {
            Property = new Dictionary <string, byte[]>
            {
                {
                    "Key1", new byte[] { 2, 3 }
                },
                {
                    "Key2", new byte[] { 5, 6 }
                }
            }
        };
        var result = RoundTrip.Run(target);

        CollectionAssert.AreEqual(new byte[] { 5, 6 }, result.Property["Key2"]);
    }
    public void IntStringDictionary()
    {
        var target = new ClassWithIntStringDictionary
        {
            Property = new Dictionary <int, string>
            {
                {
                    1, "Value1"
                },
                {
                    2, "Value2"
                }
            }
        };
        var result = RoundTrip.Run(target);

        Assert.AreEqual("Value2", result.Property[2]);
    }
    public void StringDictionary()
    {
        var target = new ClassWithStringDictionary
        {
            Property = new Dictionary <string, string>
            {
                {
                    "Key1", "Value1"
                },
                {
                    "Key2", "Value2"
                }
            }
        };
        var result = RoundTrip.Run(target);

        Assert.AreEqual("Value2", result.Property["Key2"]);
    }
    public async Task IntStringDictionary()
    {
        var target = new ClassWithIntStringDictionary
        {
            Property = new Dictionary <int, string>
            {
                {
                    1, "Value1"
                },
                {
                    2, "Value2"
                }
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("Value2", result.Property?[2]);
    }
    public async Task ByteArrayDictionary()
    {
        var target = new ClassWithByteArrayDictionary
        {
            Property = new Dictionary <string, byte[]>
            {
                {
                    "Key1", new byte[] { 2, 3 }
                },
                {
                    "Key2", new byte[] { 5, 6 }
                }
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal(new byte[] { 5, 6 }, result.Property?["Key2"]);
    }
    public async Task IntGuidDictionary()
    {
        var target = new ClassWithIntGuidDictionary
        {
            Property = new Dictionary <int, Guid>
            {
                {
                    1, new Guid("45b14050-065c-4be7-8bb8-f3b46b8d94e6")
                },
                {
                    2, new Guid("74b69ad1-f9e8-4549-8524-cce4a8b4c38b")
                }
            }
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("74b69ad1-f9e8-4549-8524-cce4a8b4c38b", result.Property?[2].ToString());
    }