コード例 #1
0
        public void LiteralEncoder_TaggedScalar()
        {
            var b = new BlobBuilder();
            var e = new LiteralEncoder(b);

            Assert.Same(b, e.Builder);

            var parts = e.TaggedScalar();

            AssertEx.Equal(new byte[0], b.ToArray());
            Assert.Same(b, parts.Item1.Builder);
            Assert.Same(b, parts.Item2.Builder);
            b.Clear();

            e.TaggedScalar(
                part => Assert.Same(b, part.Builder),
                part => Assert.Same(b, part.Builder));

            Assert.Throws <ArgumentNullException>(() => e.TaggedScalar(null, _ => { }));
            Assert.Throws <ArgumentNullException>(() => e.TaggedScalar(_ => { }, null));
        }
コード例 #2
0
        public void LiteralEncoder_TaggedScalar()
        {
            var b = new BlobBuilder();
            var e = new LiteralEncoder(b);

            Assert.Same(b, e.Builder);

            CustomAttributeElementTypeEncoder elementType;
            ScalarEncoder scalar;

            e.TaggedScalar(out elementType, out scalar);

            AssertEx.Equal(new byte[0], b.ToArray());
            Assert.Same(b, elementType.Builder);
            Assert.Same(b, scalar.Builder);
            b.Clear();

            e.TaggedScalar(
                et => Assert.Same(b, et.Builder),
                s => Assert.Same(b, s.Builder));

            Assert.Throws <ArgumentNullException>(() => e.TaggedScalar(null, s => { }));
            Assert.Throws <ArgumentNullException>(() => e.TaggedScalar(et => { }, null));
        }
コード例 #3
0
        public void LiteralEncoder_TaggedScalar()
        {
            var b = new BlobBuilder();
            var e = new LiteralEncoder(b);
            Assert.Same(b, e.Builder);

            CustomAttributeElementTypeEncoder elementType;
            ScalarEncoder scalar;
            e.TaggedScalar(out elementType, out scalar);

            AssertEx.Equal(new byte[0], b.ToArray());
            Assert.Same(b, elementType.Builder);
            Assert.Same(b, scalar.Builder);
            b.Clear();

            e.TaggedScalar(
                et => Assert.Same(b, et.Builder),
                s => Assert.Same(b, s.Builder));

            Assert.Throws<ArgumentNullException>(() => e.TaggedScalar(null, s => { }));
            Assert.Throws<ArgumentNullException>(() => e.TaggedScalar(et => { }, null));
        }
コード例 #4
0
ファイル: BlobEncodersTests.cs プロジェクト: sepidehMS/corefx
        public void LiteralEncoder_TaggedScalar()
        {
            var b = new BlobBuilder();
            var e = new LiteralEncoder(b);
            Assert.Same(b, e.Builder);

            var parts = e.TaggedScalar();

            AssertEx.Equal(new byte[0], b.ToArray());
            Assert.Same(b, parts.Item1.Builder);
            Assert.Same(b, parts.Item2.Builder);
            b.Clear();

            e.TaggedScalar(
                part => Assert.Same(b, part.Builder),
                part => Assert.Same(b, part.Builder));

            Assert.Throws<ArgumentNullException>(() => e.TaggedScalar(null, _ => { }));
            Assert.Throws<ArgumentNullException>(() => e.TaggedScalar(_ => { }, null));
        }