예제 #1
0
        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));
        }
예제 #2
0
        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)));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }