示例#1
0
        public void EmptyCollectionLengthTest()
        {
            var expected = new BoundLengthClass <List <string> > {
                Field = new List <string>()
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(expected.Field.Count * 2, actual.FieldLengthField);
            Assert.AreEqual(0, actual.Field.Count);
        }
示例#2
0
        public void LengthBindingTest2()
        {
            var expected = new BoundLengthClass <byte[]> {
                Field = System.Text.Encoding.ASCII.GetBytes("FieldValue")
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(expected.Field.Length, actual.FieldLengthField);
            Assert.IsTrue(expected.Field.SequenceEqual(actual.Field));
        }
示例#3
0
        public void LengthBindingTest()
        {
            var expected = new BoundLengthClass <string> {
                Field = "FieldValue"
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(expected.Field.Length, actual.FieldLengthField);
            Assert.AreEqual(expected.Field, actual.Field);
        }
示例#4
0
        public void CollectionLengthTest()
        {
            var expected = new BoundLengthClass <List <string> > {
                Field = new List <string>(TestSequence)
            };
            var actual = Roundtrip(expected);

            Assert.Equal(expected.Field.Count * 2, actual.FieldLengthField);
            Assert.Equal(TestSequence.Length, actual.Field.Count);
        }
示例#5
0
        public void ComplexFieldLengthTest()
        {
            var expected = new BoundLengthClass <ConstLengthClass>
            {
                Field = new ConstLengthClass {
                    Field = "FieldValue"
                }
            };
            var actual = Roundtrip(expected);

            Assert.AreEqual(3, actual.Field.Field.Length);
            Assert.AreEqual(6, actual.FieldLengthField);
        }
示例#6
0
        public void ContainedCollectionTest()
        {
            var expected = new BoundLengthClass <ContainedCollection>
            {
                Field = new ContainedCollection
                {
                    Collection = new List <string>
                    {
                        "hello",
                        "world"
                    }
                }
            };

            var actual = Roundtrip(expected);

            Assert.AreEqual(2, actual.Field.Collection.Count);
        }