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)); }
protected virtual IEnumerable <TData> SelectDataValues <TData>(string elementXPath, string elementDataJSPath, TermOptions dataTermOptions) { string fullElementXPath = BuildXPathToSelectData(elementXPath); // TODO: Add filtering by visibility. var elements = GetItemElements(By.XPath(fullElementXPath).OfAnyVisibility()); return(GetElementsData(elements, elementDataJSPath). Select(x => TermResolver.FromString <TData>(x, dataTermOptions))); }
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)); }