private static string IssuesToString(IEnumerable <IssueSummaryModel> issues) { var issueGroups = issues.ToLookup(ResolveIssueGroup); if (issueGroups.Count == 1 && issueGroups.Single().Key == IssueGroup.Other) { return(string.Join(Environment.NewLine, issues.Select(IssueToString))); } else { StringBuilder builder = new StringBuilder(); foreach (var group in issueGroups.OrderBy(x => x.Key)) { if (builder.Length > 0) { builder.AppendLine().AppendLine(); } string gorupName = TermResolver.ToString(group.Key); builder.AppendLine($"## {gorupName}").AppendLine(); builder.Append(string.Join(Environment.NewLine, group.Select(IssueToString))); } return(builder.ToString()); } }
public static string ToString(this object value, TermCase termCase) { value.CheckNotNull("value"); return(TermResolver.ToString(value, new TermOptions { Case = termCase })); }
public void TermResolver_Enum(TermCasedOption value, string expectedValue) { string resolvedString = TermResolver.ToString(value); Assert.That(resolvedString, Is.EqualTo(expectedValue)); TermCasedOption resolvedBack = TermResolver.FromString <TermCasedOption>(resolvedString); Assert.That(resolvedBack, Is.EqualTo(value)); }
public void TermResolver_Format(object value, string format, string expectedFormattedValue) { TermOptions options = new TermOptions { Format = format }; string formatted = TermResolver.ToString(value, options); Assert.That(formatted, Is.EqualTo(expectedFormattedValue)); object unformatted = TermResolver.FromString(formatted, value.GetType(), options); Assert.That(unformatted, Is.EqualTo(value)); }
public void TermResolver_Enum_WithCase(TermCasedOption value, TermCase termCase, string expectedValue) { TermOptions options = new TermOptions { Case = termCase }; string resolvedString = TermResolver.ToString(value, options); Assert.That(resolvedString, Is.EqualTo(expectedValue)); TermCasedOption resolvedBack = TermResolver.FromString <TermCasedOption>(resolvedString, options); Assert.That(resolvedBack, Is.EqualTo(value)); }
/// <summary> /// Gets the value and records it to <paramref name="value"/> parameter. /// </summary> /// <typeparam name="TValue">The type of the data value.</typeparam> /// <typeparam name="TOwner">The type of the owner page object.</typeparam> /// <param name="provider">The data provider.</param> /// <param name="value">The value.</param> /// <returns>The instance of the owner page object.</returns> internal static string ConvertValueToString <TValue, TOwner>(this IDataProvider <TValue, TOwner> provider, TValue value) where TOwner : PageObject <TOwner> { return(TermResolver.ToString(value, provider.ValueTermOptions)); }