Exemple #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);
        }
Exemple #2
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);
        }
Exemple #3
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));
        }
Exemple #4
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);
        }
Exemple #5
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);
        }