Пример #1
0
        /// <summary>
        /// Returns the property name. If is null or empty then returns this property name.
        /// </summary>
        /// <returns>
        /// Property name.
        /// </returns>
        public string GetPropertyName()
        {
            string name = PropertyId.GetPropertyName();

            return(string.IsNullOrEmpty(name)
                ? PropertyId.ToString()
                : name);
        }
Пример #2
0
 protected override Expression <Func <Product, bool> > GenerateExpression()
 {
     return(p => p.AttributeValues.RootElement
            .GetProperty(PropertyId.ToString())
            .GetInt32() >= Min && p.AttributeValues.RootElement
            .GetProperty(PropertyId.ToString())
            .GetInt32() <= Max);
 }
Пример #3
0
        protected override Expression <Func <Product, bool> > GenerateExpression()
        {
            if (string.IsNullOrWhiteSpace(Query))
            {
                return(p => true);
            }

            return(p => p.AttributeValues.RootElement
                   .GetProperty(PropertyId.ToString())
                   .GetString().ToLower().Contains(Query.ToLower()));
        }
Пример #4
0
        public string productCode => $"{this.Category}-{this.sequencenumber:0000}";  //String interpolation replaces above code -C# 6

        public string SayHelloTest()
        {
            var vendor = new Vendor();

            vendor.SendWelcomeEmail("welcome to the email");

            var emailservice = new EmailService();


            emailservice.SendMessage("test message", this.productName, "*****@*****.**");

            //c# 6 , we can import statis classes, using static Acme.Common.LoggingService;
            var result = LoggingService.LogAction("Say hello");

            return("This is a test for PropertyID " + PropertyId.ToString() + "Product Avaialble on" + AvailabilityDate?.ToShortDateString());
        }
Пример #5
0
        // Token: 0x06001C0A RID: 7178 RVA: 0x000D642C File Offset: 0x000D462C
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder(896);

            for (PropertyId propertyId = PropertyId.FontColor; propertyId < PropertyId.MaxValue; propertyId += 1)
            {
                if (this.IsSet(propertyId))
                {
                    if (stringBuilder.Length != 0)
                    {
                        stringBuilder.Append(", ");
                    }
                    stringBuilder.Append(propertyId.ToString());
                }
            }
            return(stringBuilder.ToString());
        }
Пример #6
0
        public override string ToString()
        {
            string result = "";

            for (PropertyId pid = FirstNonFlag; pid < PropertyId.MaxValue; pid++)
            {
                if (this.IsSet(pid))
                {
                    if (result.Length != 0)
                    {
                        result += ", ";
                    }
                    result += pid.ToString();
                }
            }

            return(result);
        }
Пример #7
0
        public override string ToString()
        {
            string result = "";

            for (PropertyId pid = PropertyId.FirstFlag; pid <= PropertyId.LastFlag; pid++)
            {
                if (this.IsDefined(pid))
                {
                    if (result.Length != 0)
                    {
                        result += ", ";
                    }
                    result += pid.ToString() + (this.IsOn(pid) ? ":on" : ":off");
                }
            }

            return(result);
        }
Пример #8
0
        // Token: 0x06001BF7 RID: 7159 RVA: 0x000D6120 File Offset: 0x000D4320
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder(240);

            for (PropertyId propertyId = PropertyId.FirstFlag; propertyId <= PropertyId.MergedCell; propertyId += 1)
            {
                if (this.IsDefined(propertyId))
                {
                    if (stringBuilder.Length != 0)
                    {
                        stringBuilder.Append(", ");
                    }
                    stringBuilder.Append(propertyId.ToString());
                    stringBuilder.Append(this.IsOn(propertyId) ? ":on" : ":off");
                }
            }
            return(stringBuilder.ToString());
        }
Пример #9
0
        protected override Expression <Func <Product, bool> > GenerateExpression()
        {
            Expression <Func <Product, bool> > expr = p => true;

            if (Options.Count > 0)
            {
                var option = Options[0];
                expr = p =>
                       p.AttributeValues.RootElement.GetProperty(PropertyId.ToString())
                       .GetString() == option;
            }

            foreach (var option in Options.Skip(1))
            {
                expr = expr.Or(p => p.AttributeValues.RootElement.GetProperty(PropertyId.ToString())
                               .GetString() == option);
            }

            return(expr);
        }
Пример #10
0
        /// <summary>
        /// Check if an unexpected message with a specific property value exists in the target mailbox.
        /// </summary>
        /// <param name="folderHandle">Handle of a specific folder.</param>
        /// <param name="contentsTableHandle">Handle of a specific contents table.</param>
        /// <param name="propertyTagList">>Array of PropertyTag structures. This field specifies the property values that are visible in table rows.</param>
        /// <param name="unexpectedPropertyValue">The value of a specific property of the message to be checked in the target mailbox.</param>
        /// <param name="propertyName">The property name of a specific property of the message to be checked in the target mailbox, which type should be string. The default property name is PidTagSubject.</param>
        /// <returns>A bool value indicates whether a message with specific property value exists in the target mailbox. True means exist, otherwise not.</returns>
        protected bool CheckUnexpectedMessageExist(uint folderHandle, ref uint contentsTableHandle, PropertyTag[] propertyTagList, string unexpectedPropertyValue, PropertyId propertyName = PropertyId.PidTagSubject)
        {
            bool doesUnexpectedMessageExist       = false;
            bool isExpectedPropertyInPropertyList = false;
            RopGetContentsTableResponse ropGetContentTableResponse = this.OxoruleAdapter.RopGetContentsTable(folderHandle, ContentTableFlag.None, out contentsTableHandle);

            Site.Assert.AreEqual <uint>(0, ropGetContentTableResponse.ReturnValue, "Getting contents table should succeed.");

            RopQueryRowsResponse getNormalMailMessageContent = this.OxoruleAdapter.QueryPropertiesInTable(contentsTableHandle, propertyTagList);

            Site.Assert.AreEqual <uint>(0, getNormalMailMessageContent.ReturnValue, "Getting mail message operation should succeed.");
            if (getNormalMailMessageContent.RowData.Count > 0)
            {
                for (int i = 0; i < propertyTagList.Length; i++)
                {
                    if (propertyTagList[i].PropertyId == (ushort)propertyName)
                    {
                        isExpectedPropertyInPropertyList = true;
                        for (int j = 0; j < getNormalMailMessageContent.RowData.PropertyRows.Count; j++)
                        {
                            string propertyValue = AdapterHelper.PropertyValueConvertToString(getNormalMailMessageContent.RowData.PropertyRows[j].PropertyValues[i].Value);
                            Site.Log.Add(LogEntryKind.Debug, "The value of the {0} property of the No.{1} message is : {2}", propertyName.ToString(), j + 1, propertyValue);
                            if (propertyValue.Contains(unexpectedPropertyValue))
                            {
                                doesUnexpectedMessageExist = true;
                                return(doesUnexpectedMessageExist);
                            }
                        }
                    }
                }

                Site.Assert.IsTrue(isExpectedPropertyInPropertyList, "The property {0} to be checked should be included in the property list.", propertyName.ToString());
            }

            return(doesUnexpectedMessageExist);
        }
Пример #11
0
        /// <summary>
        /// Get the expected message properties included in a specific contents table after retry preconfigured times.
        /// </summary>
        /// <param name="folderHandle">Handle of a specific folder.</param>
        /// <param name="contentsTableHandle">Handle of a specific contents table.</param>
        /// <param name="propertyTagList">>Array of PropertyTag structures. This field specifies the property values that are visible in table rows.</param>
        /// <param name="expectedMessageIndex">The index of the specific message in the table.</param>
        /// <param name="expectedPropertyValue">The value of a specific property of the message to be found in the target mailbox.</param>
        /// <param name="expectedPropertyName">The property name of a specific property of the message to be found in the target mailbox, which type should be string. The default property name is PidTagSubject.</param>
        /// <returns>Response of the RopQueryRow ROP contents the expected message properties.</returns>
        protected RopQueryRowsResponse GetExpectedMessage(uint folderHandle, ref uint contentsTableHandle, PropertyTag[] propertyTagList, ref int expectedMessageIndex, string expectedPropertyValue, PropertyId expectedPropertyName = PropertyId.PidTagSubject)
        {
            RopQueryRowsResponse getNormalMailMessageContent = new RopQueryRowsResponse();
            uint repeatTime = 0;
            uint rowCount   = 0;
            bool isExpectedPropertyInPropertyList = false;

            // If retry time more than expected, terminates the loop
            while (repeatTime < this.getMessageRepeatTime)
            {
                RopGetContentsTableResponse ropGetContentsTableResponse = this.OxoruleAdapter.RopGetContentsTable(folderHandle, ContentTableFlag.None, out contentsTableHandle);
                Site.Assert.AreEqual <uint>(0, ropGetContentsTableResponse.ReturnValue, "Getting contents table should succeed.");
                rowCount = ropGetContentsTableResponse.RowCount;
                repeatTime++;

                if (rowCount > 0)
                {
                    getNormalMailMessageContent = this.OxoruleAdapter.QueryPropertiesInTable(contentsTableHandle, propertyTagList);
                    Site.Assert.AreEqual <uint>(0, getNormalMailMessageContent.ReturnValue, "Getting mail message operation should succeed.");

                    for (int i = 0; i < propertyTagList.Length; i++)
                    {
                        if (propertyTagList[i].PropertyId == (ushort)expectedPropertyName)
                        {
                            isExpectedPropertyInPropertyList = true;
                            for (int j = 0; j < getNormalMailMessageContent.RowData.PropertyRows.Count; j++)
                            {
                                string propertyValue = AdapterHelper.PropertyValueConvertToString(getNormalMailMessageContent.RowData.PropertyRows[j].PropertyValues[i].Value);
                                if (propertyValue.Contains(expectedPropertyValue))
                                {
                                    expectedMessageIndex = j;
                                    return(getNormalMailMessageContent);
                                }
                            }
                        }
                    }

                    Site.Assert.IsTrue(isExpectedPropertyInPropertyList, "The property {0} to be checked should be included in the property list.", expectedPropertyName.ToString());
                }

                if (repeatTime == this.getMessageRepeatTime)
                {
                    break;
                }

                Thread.Sleep(this.WaitForTheRuleToTakeEffect);
            }

            Site.Assert.Fail("Can't find the message which has a property {0} ant its value is {1} in the target mailbox.", expectedPropertyName.ToString(), expectedPropertyValue);
            return(getNormalMailMessageContent);
        }
Пример #12
0
 public override string ToString()
 {
     return(PropertyId.ToString() + "|" + DataType + "|" + Value + "|" + ItemId + "|" + Description);
 }
Пример #13
0
 /// <summary>
 /// override ToString()
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return("PKey: " + FormatId.ToString() + ":" + PropertyId.ToString(CultureInfo.InvariantCulture.NumberFormat));
 }
Пример #14
0
        /*
         * <propertyDescription name="Microsoft.SDKSample.DirectoryLevel" formatID="{581CF603-2925-4acf-BB5A-3D3EB39EACD3}" propID="3">
         *  <description>Number of directory levels to this item.</description>
         *  <searchInfo inInvertedIndex="false" isColumn="false,
         *  <typeInfo canStackBy="false" type="Int32"/>
         *  <labelInfo label="Directory Level"/>
         * </propertyDescription>
         */
        internal XmlElement GetXmlPropertyDescription(XmlDocument doc)
        {
            var desc = doc.CreateElement("propertyDescription");

            desc.SetAttribute("name", CanonicalName);
            desc.SetAttribute("formatID", FormatId.ToString("B").ToUpper());
            desc.SetAttribute("propID", PropertyId.ToString());

            var search = doc.CreateElement("searchInfo");

            search.SetAttribute("inInvertedIndex", InInvertedIndex.ToString());
            if (IsColumn)
            {
                search.SetAttribute("isColumn", IsColumn.ToString());
                search.SetAttribute("isColumnSparse", IsColumnSparse.ToString());
                search.SetAttribute("columnIndexType", ColumnIndexType.ToString());
            }
            if (MaxSize != 512)
            {
                search.SetAttribute("maxSize", MaxSize.ToString());
            }
            if (Mnemonics != null && Mnemonics.Length > 0)
            {
                search.SetAttribute("mnemonics", Mnemonics);
            }
            desc.AppendChild(search);

            var label = doc.CreateElement("labelInfo");

            label.SetAttribute("label", DisplayName);
            label.SetAttribute("sortDescription", SortDescription.ToString());
            if (EditInvitation != null && EditInvitation.Length > 0)
            {
                label.SetAttribute("invitationText", EditInvitation);
            }
            if (HideLabel)
            {
                label.SetAttribute("hideLabel", HideLabel.ToString());
            }
            desc.AppendChild(label);

            var type = doc.CreateElement("typeInfo");

            type.SetAttribute("type", Type.ToString());
            if (GroupingRange != PropertyGroupingRange.Discrete)
            {
                type.SetAttribute("groupingRange", GroupingRange.ToString());
            }
            if (IsInnate)
            {
                type.SetAttribute("isInnate", IsInnate.ToString());
            }
            if (IsInnate && CanBePurged)
            {
                type.SetAttribute("canBePurged", CanBePurged.ToString());
            }
            //if (MultipleValues)
            type.SetAttribute("multipleValues", MultipleValues.ToString());
            if (IsGroup)
            {
                type.SetAttribute("isGroup", IsGroup.ToString());
            }
            if (AggregationType != PropertyAggregationType.Default)
            {
                type.SetAttribute("aggregationType", AggregationType.ToString());
            }
            if (IsTreeProperty)
            {
                type.SetAttribute("isTreeProperty", IsTreeProperty.ToString());
            }
            if (IsViewable)
            {
                type.SetAttribute("isViewable", IsViewable.ToString());
            }
            if (SearchRawValue)
            {
                type.SetAttribute("searchRawValue", SearchRawValue.ToString());
            }
            if (ConditionType != PropertyConditionType.String)
            {
                type.SetAttribute("conditionType", ConditionType.ToString());
            }
            if (ConditionOperation != ConditionOperationConfigured.Equal)
            {
                type.SetAttribute("defaultOperation", ConditionOperation.ToString());
            }
            desc.AppendChild(type);

            var display = doc.CreateElement("displayInfo");

            display.SetAttribute("displayType", DisplayType.ToString());
            if (DisplayType == PropertyDisplayType.String && StringFormat != StringFormat.General)
            {
                var format = doc.CreateElement("stringFormat");
                format.SetAttribute("formatAs", StringFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.Boolean && BooleanFormat != BooleanFormat.YesNo)
            {
                var format = doc.CreateElement("booleanFormat");
                format.SetAttribute("formatAs", BooleanFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.Number && NumberFormat != NumberFormat.General)
            {
                var format = doc.CreateElement("numberFormat");
                format.SetAttribute("formatAs", NumberFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.DateTime && DateTimeFormat != DateTimeFormat.General)
            {
                var format = doc.CreateElement("dateTimeFormat");
                format.SetAttribute("formatAs", DateTimeFormat.ToString());
                display.AppendChild(format);
            }



            if (DefaultColumnWidth != 20)
            {
                display.SetAttribute("defaultColumnWidth", DefaultColumnWidth.ToString());
            }
            if (Alignment != PropertyAlignmentType.Left)
            {
                display.SetAttribute("alignment", Alignment.ToString());
            }
            //if (RelativeDescriptionType != RelativeDescriptionType.General)
            //  display.SetAttribute("relativeDescriptionType", RelativeDescriptionType.ToString());
            if (DefaultSortDirection != SortDirection.Ascending)
            {
                display.SetAttribute("defaultSortDirection", DefaultSortDirection.ToString());
            }
            if (EditControl != EditControl.Default)
            {
                var edit = doc.CreateElement("editControl");
                edit.SetAttribute("control", EditControl.ToString());
                display.AppendChild(edit);
            }
            desc.AppendChild(display);

            return(desc);
        }
Пример #15
0
 public override string ToString()
 {
     return(id.ToString() + " = " + value.ToString());
 }