public override object Clone() { QuestionTextPart newPart = new QuestionTextPart(); newPart.Id = this.Id; newPart.Text = this.Text; return(newPart); }
private static IEnumerable <QuestionTextPart> CreateDoubleTextValue(int leftMinValue, int leftMaxValue, int rightMinValue, int rightMaxValue) { Random rand = new Random((int)DateTime.Now.Ticks); int partLeft = rand.Next(leftMinValue, leftMaxValue + 1); Thread.Sleep(50); int partRight = rand.Next(rightMinValue, rightMaxValue + 1); double value = Convert.ToDouble(string.Format("{0}.{1}", partLeft, partRight)); QuestionTextPart valuePart = new QuestionTextPart(value.ToString()); yield return(valuePart); }
public override int CompareTo(QuestionContentPart other) { if (this == other) { return(0); } if (!(other is QuestionTextPart)) { return(-1); } QuestionTextPart textPart = other as QuestionTextPart; return(this.text.CompareTo(textPart.Text)); }
internal static IEnumerable <QuestionOption> CreateDoubleTextOption(int leftMinValue, int leftMaxValue, int rightMinValue, int rightMaxValue, string suffix) { QuestionTextPart textValue = null; foreach (QuestionTextPart value in CreateDoubleTextValue(leftMinValue, leftMaxValue, rightMinValue, rightMaxValue)) { textValue = value; } textValue.Text += suffix; QuestionOption option = new QuestionOption(); option.OptionContent.Content = textValue.PlaceHolder; option.OptionContent.ContentType = ContentType.Text; option.OptionContent.QuestionPartCollection.Add(textValue); yield return(option); }