コード例 #1
0
    public async Task NullString()
    {
        var target = new ClassWithString();
        var result = await RoundTrip.Run(target);

        Assert.Null(result.Property);
    }
コード例 #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());
    }
コード例 #3
0
    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);
    }
コード例 #4
0
    public async Task EmptyString()
    {
        var target = new ClassWithString
        {
            Property = string.Empty
        };
        var result = await RoundTrip.Run(target);

        Assert.Empty(result.Property);
    }
コード例 #5
0
    public void String()
    {
        var target = new ClassWithString
        {
            Property = "Foo"
        };
        var result = RoundTrip.Run(target);

        Assert.AreEqual("Foo", result.Property);
    }
コード例 #6
0
    public async Task String()
    {
        var target = new ClassWithString
        {
            Property = "Foo"
        };
        var result = await RoundTrip.Run(target);

        Assert.Equal("Foo", result.Property);
    }
コード例 #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);
    }
コード例 #8
0
    public void NodeWithConverter()
    {
        var target = new WithConverterTargetClass
        {
            Property = "AbCd"
        };
        var result = RoundTrip.Run(target);

        Assert.Equal("AbCd", result.Property);
        ReverseConverter.AssertReadWriteCalled();
    }
コード例 #9
0
    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());
    }
コード例 #10
0
    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]);
    }
コード例 #11
0
    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]);
    }
コード例 #13
0
    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);
    }
コード例 #14
0
    public void StringEnumerable()
    {
        var target = new ClassWithStringEnumerable
        {
            Property = new List <string>
            {
                "Value1",
                "Value2"
            }
        };
        var result = RoundTrip.Run(target);

        Assert.Equal("Value2", result.Property.Last());
    }
コード例 #15
0
    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());
    }
コード例 #16
0
    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]);
    }
コード例 #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);
    }
コード例 #18
0
    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"]);
    }
コード例 #19
0
    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"]);
    }
コード例 #20
0
    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]);
    }
コード例 #21
0
    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"]);
    }
コード例 #22
0
    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]);
    }
コード例 #23
0
    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"]);
    }
コード例 #24
0
    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());
    }