public void SgfComposeValueWithEscapedColonsCanBeParsed()
        {
            var compose = SgfComposePropertyValue <string, string> .Parse("hell\\:o wae\\\\:\\:\\\\\\:", SgfTextValue.Parse, SgfSimpleTextValue.Parse);

            Assert.AreEqual("hell:o wae\\", compose.LeftValue);
            Assert.AreEqual(":\\:", compose.RightValue);
        }
        public void ValidSgfComposeValueCanBeParsed()
        {
            var compose = SgfComposePropertyValue <string, int> .Parse("hello wae:1", SgfTextValue.Parse, SgfNumberValue.Parse);

            Assert.AreEqual("hello wae", compose.LeftValue);
            Assert.AreEqual(1, compose.RightValue);
        }
        public void SgfComposeValueIsProperlySerialized()
        {
            var compose = new SgfComposePropertyValue <string, string>(new SgfTextValue("Hello, wo:rld"), new SgfTextValue("::::"));

            Assert.AreEqual("Hello, wo\\:rld:\\:\\:\\:\\:", compose.Serialize());
        }
 public void SgfComposeRightParserNullParseThrows()
 {
     SgfComposePropertyValue <string, string> .Parse("1:2", SgfNumberValue.Parse, null);
 }
 public void SgfComposeNullParseThrows()
 {
     SgfComposePropertyValue <string, string> .Parse(null, SgfNumberValue.Parse, SgfNumberValue.Parse);
 }
Пример #6
0
 /// <summary>
 /// Generates SGF Property Value parser for compose values
 /// </summary>
 /// <typeparam name="TLeft">Type of the left value</typeparam>
 /// <typeparam name="TRight">Type of the right value</typeparam>
 /// <param name="left">Left value parser</param>
 /// <param name="right">Right value parser</param>
 /// <returns></returns>
 private static SgfPropertyValueParser Compose <TLeft, TRight>(SgfPropertyValueParser left, SgfPropertyValueParser right)
 {
     //create a parser function using closure
     return((value) => SgfComposePropertyValue <TLeft, TRight> .Parse(value, left, right));
 }