DocSpace-buildtools/common/Tests/Frontend.Translations.Tests/Models/SpellCheckResult.cs
AlexeySafronov 4274e3a581 Web: Tests:
+ Added new SpellCheckTest() and submodule (common/Tests/Frontend.Translations.Tests/dictionaries)
+ Split tests on categories FastRunning|LongRunning
+ Added new build/run.translations.spellcheck.test.bat
2021-12-21 16:59:04 +03:00

37 lines
954 B
C#

using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Frontend.Translations.Tests.Models
{
public class SpellCheckResult
{
private Regex wordRegex = new Regex(@"\p{L}+", RegexOptions.Multiline | RegexOptions.Compiled);
public SpellCheckResult(string text)
{
Text = text;
Words = wordRegex.Matches(text).Select(m => m.Value)
.Where(w => !string.IsNullOrEmpty(w))
.Where(w => !w.StartsWith("{{"))
.ToList();
SpellIssues = new List<SpellIssue>();
}
public string Text { get; }
public List<string> Words { get; }
public List<SpellIssue> SpellIssues { get; set; }
public bool HasProblems
{
get
{
return SpellIssues.Any(issue => issue.Suggestions.Any());
}
}
}
}