public void NamedArgumentTypeEncoder_Object()
        {
            var b = new BlobBuilder();
            var e = new NamedArgumentTypeEncoder(b);

            Assert.Same(b, e.Builder);

            e.Object();
            AssertEx.Equal(new byte[] { 0x51 }, b.ToArray());
            b.Clear();
        }
Esempio n. 2
0
        public static void NamedArgumentType(this NamedArgumentTypeEncoder encoder, INamedTypeSymbol attributeType, string field)
        {
            var fieldMembers = attributeType.GetMembers(field);
            var fieldSymbol  = fieldMembers.First() as IFieldSymbol;

            if (fieldSymbol.Type.SpecialType == SpecialType.System_Object)
            {
                encoder.Object();
            }
            else if (fieldSymbol.Type.SpecialType == SpecialType.System_Array)
            {
                // TODO array type encoder
                encoder.SZArray();
            }
            else if (fieldSymbol.Type.TypeKind == TypeKind.Enum)
            {
                encoder.ScalarType().Enum(fieldSymbol.Type.ToString());
            }
            else
            {
                encoder.ScalarType().CustomElementType(fieldSymbol);
            }
        }
Esempio n. 3
0
        public void NamedArgumentTypeEncoder_Object()
        {
            var b = new BlobBuilder();
            var e = new NamedArgumentTypeEncoder(b);
            Assert.Same(b, e.Builder);

            e.Object();
            AssertEx.Equal(new byte[] { 0x51 }, b.ToArray());
            b.Clear();
        }