Esempio n. 1
0
        public void PropertyHelper_DoesNotFindPrivateProperties()
        {
            // Arrange
            var anonymous = new PrivateProperties();

            // Act + Assert
            var helper = Assert2.Single(PropertyHelper.GetPropertyAccessors(anonymous.GetType().GetTypeInfo()));

            Assert2.Equal("Prop1", helper.Name);
        }
Esempio n. 2
0
        public void PropertyHelper_DoesNotFindPrivateProperties()
        {
            // Arrange
            var anonymous = new PrivateProperties();

            // Act + Assert
            var helper = Assert.Single(PropertyHelper.GetProperties(anonymous));

            Assert.Equal("Prop1", helper.Name);
        }
        public void PropertyHelperDoesNotFindPrivateProperties()
        {
            // Arrange
            var anonymous = new PrivateProperties();

            // Act
            PropertyHelper helper = PropertyHelper.GetProperties(anonymous).Single();

            // Assert
            Assert.Equal("Prop1", helper.Name);
        }
Esempio n. 4
0
        public IEnumerable <PropertyContents> AllPropertiesWithName(string name)
        {
            PropertyContents prop = null;

            if (Properties.TryGetValue(name, out prop))
            {
                yield return(prop);
            }
            if (PrivateProperties.TryGetValue(name, out prop))
            {
                yield return(prop);
            }
            if (StaticProperties.TryGetValue(name, out prop))
            {
                yield return(prop);
            }
            if (StaticPrivateProperties.TryGetValue(name, out prop))
            {
                yield return(prop);
            }
        }
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("THApplication");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (Id != null && __isset.id)
         {
             field.Name = "id";
             field.Type = TType.String;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Id);
             oprot.WriteFieldEnd();
         }
         if (AppId != null && __isset.appId)
         {
             field.Name = "appId";
             field.Type = TType.String;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(AppId);
             oprot.WriteFieldEnd();
         }
         if (CompanyId != null && __isset.companyId)
         {
             field.Name = "companyId";
             field.Type = TType.String;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(CompanyId);
             oprot.WriteFieldEnd();
         }
         if (Name != null && __isset.name)
         {
             field.Name = "name";
             field.Type = TType.String;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Name);
             oprot.WriteFieldEnd();
         }
         if (IconUrl != null && __isset.iconUrl)
         {
             field.Name = "iconUrl";
             field.Type = TType.String;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(IconUrl);
             oprot.WriteFieldEnd();
         }
         if (PublicProperties != null && __isset.publicProperties)
         {
             field.Name = "publicProperties";
             field.Type = TType.Struct;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             PublicProperties.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (PrivateProperties != null && __isset.privateProperties)
         {
             field.Name = "privateProperties";
             field.Type = TType.Struct;
             field.ID   = 7;
             oprot.WriteFieldBegin(field);
             PrivateProperties.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (AnalyticsToken != null && __isset.analyticsToken)
         {
             field.Name = "analyticsToken";
             field.Type = TType.String;
             field.ID   = 8;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(AnalyticsToken);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
Esempio n. 6
0
        public void PropertyHelper_DoesNotFindPrivateProperties()
        {
            // Arrange
            var anonymous = new PrivateProperties();

            // Act + Assert
            var helper = Assert.Single(PropertyHelper.GetProperties(anonymous));
            Assert.Equal("Prop1", helper.Name);
        }
Esempio n. 7
0
        public void Add(TLDefinition tld, Stream srcStm)
        {
            TLFunction tlf = tld as TLFunction;

            if (tlf != null)
            {
                if (IsConstructor(tlf.Signature, tlf.Class))
                {
                    Constructors.Add(tlf, srcStm);
                }
                else if (tlf.Signature is SwiftClassConstructorType)
                {
                    if (ClassConstructor.Values.Count() == 0)
                    {
                        ClassConstructor.Add(tlf, srcStm);
                    }
                    else
                    {
                        throw ErrorHelper.CreateError(ReflectorError.kInventoryBase + 12, $"multiple type metadata accessors for {tlf.Class.ClassName.ToFullyQualifiedName ()}");
                    }
                }
                else if (IsDestructor(tlf.Signature, tlf.Class))
                {
                    Destructors.Add(tlf, srcStm);
                }
                else if (IsProperty(tlf.Signature, tlf.Class))
                {
                    if (IsSubscript(tlf.Signature, tlf.Class))
                    {
                        if (IsPrivateProperty(tlf.Signature, tlf.Class))
                        {
                            PrivateSubscripts.Add(tlf);
                        }
                        else
                        {
                            Subscripts.Add(tlf);
                        }
                    }
                    else
                    {
                        if (IsStaticProperty(tlf.Signature, tlf.Class))
                        {
                            if (IsPrivateProperty(tlf.Signature, tlf.Class))
                            {
                                StaticPrivateProperties.Add(tlf, srcStm);
                            }
                            else
                            {
                                StaticProperties.Add(tlf, srcStm);
                            }
                        }
                        else
                        {
                            if (IsPrivateProperty(tlf.Signature, tlf.Class))
                            {
                                PrivateProperties.Add(tlf, srcStm);
                            }
                            else
                            {
                                Properties.Add(tlf, srcStm);
                            }
                        }
                    }
                }
                else if (IsMethodOnClass(tlf.Signature, tlf.Class))
                {
                    if (tlf is TLMethodDescriptor)
                    {
                        MethodDescriptors.Add(tlf, srcStm);
                    }
                    else
                    {
                        Methods.Add(tlf, srcStm);
                    }
                }
                else if (IsStaticMethod(tlf.Signature, tlf.Class))
                {
                    StaticFunctions.Add(tlf, srcStm);
                }
                else if (IsWitnessTable(tlf.Signature, tlf.Class))
                {
                    WitnessTable.Add(tlf, srcStm);
                }
                else if (IsInitializer(tlf.Signature, tlf.Class))
                {
                    Initializers.Add(tlf, srcStm);
                }
                else
                {
                    FunctionsOfUnknownDestination.Add(tlf);
                }
                return;
            }
            var meta = tld as TLDirectMetadata;

            if (meta != null)
            {
                if (DirectMetadata != null)
                {
                    throw ErrorHelper.CreateError(ReflectorError.kInventoryBase + 13, $"duplicate direct metadata in class {DirectMetadata.Class.ClassName.ToFullyQualifiedName ()}");
                }
                DirectMetadata = meta;
                return;
            }
            var lazy = tld as TLLazyCacheVariable;

            if (lazy != null)
            {
                if (LazyCacheVariable != null)
                {
                    throw ErrorHelper.CreateError(ReflectorError.kInventoryBase + 14, $"duplicate lazy cache variable in class {LazyCacheVariable.Class.ClassName.ToFullyQualifiedName ()}");
                }
                LazyCacheVariable = lazy;
                return;
            }
            var mc = tld as TLMetaclass;

            if (mc != null)
            {
                if (Metaclass != null)
                {
                    throw ErrorHelper.CreateError(ReflectorError.kInventoryBase + 15, $"duplicate type meta data descriptor in class {Metaclass.Class.ClassName.ToFullyQualifiedName ()}");
                }
                Metaclass = mc;
                return;
            }
            var nom = tld as TLNominalTypeDescriptor;

            if (nom != null)
            {
                if (TypeDescriptor != null)
                {
                    throw ErrorHelper.CreateError(ReflectorError.kInventoryBase + 16, $"duplicate nominal type descriptor in class {TypeDescriptor.Class.ClassName.ToFullyQualifiedName ()}");
                }
                TypeDescriptor = nom;
                return;
            }
            var tlvar = tld as TLVariable;

            if (tlvar != null)
            {
                if (tlvar is TLPropertyDescriptor tlpropDesc)
                {
                    PropertyDescriptors.Add(tlpropDesc);
                }
                else
                {
                    Variables.Add(tlvar, srcStm);
                }
                return;
            }
            var tlprot = tld as TLProtocolConformanceDescriptor;

            if (tlprot != null)
            {
                ProtocolConformanceDescriptors.Add(tlprot);
                return;
            }
            DefinitionsOfUnknownDestination.Add(tld);
        }
        public void PropertyHelperDoesNotFindPrivateProperties()
        {
            // Arrange
            var anonymous = new PrivateProperties();

            // Act
            PropertyHelper helper = PropertyHelper.GetProperties(anonymous).Single();

            // Assert
            Assert.Equal("Prop1", helper.Name);
        }
 public override string ToString()
 {
     return($"{base.ToString()}, PrivateProperties: {PrivateProperties.ToDebugString()}, BanInfo: {BanInfo}");
 }
Esempio n. 10
0
 public Stylesheet(string uri) : base("link")
 {
     PrivateProperties.Add("rel", "stylesheet");
     PrivateProperties.Add("type", "text/css");
     PrivateProperties.Add("href", uri);
 }
Esempio n. 11
0
 public Javascript(string uri) : base("script", null)
 {
     PrivateProperties.Add("type", "text/javascript");
     PrivateProperties.Add("src", uri);
 }
Esempio n. 12
0
 public InlineStylesheet(string content) : base("style", content)
 {
     PrivateProperties.Add("type", "text/css");
 }
Esempio n. 13
0
 public InlineJavaScript(string content) : base("script", content)
 {
     PrivateProperties.Add("type", "text/javascript");
 }
Esempio n. 14
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("THPrivateUser(");
            bool          __first = true;

            if (Id != null && __isset.id)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Id: ");
                __sb.Append(Id);
            }
            if (Password != null && __isset.password)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Password: "******", ");
                }
                __first = false;
                __sb.Append("DisplayName: ");
                __sb.Append(DisplayName);
            }
            if (AvatarUrl != null && __isset.avatarUrl)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("AvatarUrl: ");
                __sb.Append(AvatarUrl);
            }
            if (PublicProperties != null && __isset.publicProperties)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PublicProperties: ");
                __sb.Append(PublicProperties.ToDebugString());
            }
            if (PrivateProperties != null && __isset.privateProperties)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PrivateProperties: ");
                __sb.Append(PrivateProperties.ToDebugString());
            }
            if (InternalPublicProperties != null && __isset.internalPublicProperties)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("InternalPublicProperties: ");
                __sb.Append(InternalPublicProperties.ToDebugString());
            }
            if (Identities != null && __isset.identities)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Identities: ");
                __sb.Append(Identities.ToDebugString());
            }
            if (InternalPrivateProperties != null && __isset.internalPrivateProperties)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("InternalPrivateProperties: ");
                __sb.Append(InternalPrivateProperties.ToDebugString());
            }
            if (InstallDate != null && __isset.installDate)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("InstallDate: ");
                __sb.Append(InstallDate);
            }
            if (InstallProvider != null && __isset.installProvider)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("InstallProvider: ");
                __sb.Append(InstallProvider);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
Esempio n. 15
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("SFActionConfig(");
            bool          __first = true;

            if (__isset.limit)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Limit: ");
                __sb.Append(Limit);
            }
            if (PublicProperties != null && __isset.publicProperties)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PublicProperties: ");
                __sb.Append(PublicProperties.ToDebugString());
            }
            if (PrivateProperties != null && __isset.privateProperties)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PrivateProperties: ");
                __sb.Append(PrivateProperties.ToDebugString());
            }
            if (TemplateName != null && __isset.templateName)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("TemplateName: ");
                __sb.Append(TemplateName);
            }
            if (WhEventName != null && __isset.whEventName)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("WhEventName: ");
                __sb.Append(WhEventName);
            }
            if (WhCustomData != null && __isset.whCustomData)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("WhCustomData: ");
                __sb.Append(WhCustomData.ToDebugString());
            }
            if (__isset.count)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Count: ");
                __sb.Append(Count);
            }
            if (ReferrerEvent != null && __isset.referrerEvent)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("ReferrerEvent: ");
                __sb.Append(ReferrerEvent);
            }
            if (__isset.banPeriod)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("BanPeriod: ");
                __sb.Append(BanPeriod);
            }
            if (BanReason != null && __isset.banReason)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("BanReason: ");
                __sb.Append(BanReason);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }