Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }