Beispiel #1
0
        public void StringWithEscapedNewlinesCanBeParsed()
        {
            var propertyValue = SgfTextValue.Parse("Hello,\\\r world.");

            Assert.AreEqual(
                $"Hello, world.",
                propertyValue.Value);
        }
Beispiel #2
0
        public void StringWithNewlinesCanBeParsed()
        {
            var propertyValue = SgfTextValue.Parse("Hello,\r \n \r\n \n\rworld.");

            Assert.AreEqual(
                $"Hello,{Environment.NewLine} {Environment.NewLine} {Environment.NewLine} {Environment.NewLine}world.",
                propertyValue.Value);
        }
Beispiel #3
0
        public void ValidSgfNodeWithPropertiesCanBeCreated()
        {
            var node = new SgfNode(new []
            {
                new SgfProperty("FF", new [] { SgfNumberValue.Parse("4") }),
                new SgfProperty("C", new [] { SgfTextValue.Parse("Test") })
            });

            Assert.AreEqual(2, node.Count());
            Assert.AreEqual("FF", node["FF"].Identifier);
            Assert.AreEqual(4, node["FF"].Value <int>());
            Assert.AreEqual("C", node["C"].Identifier);
            Assert.AreEqual("Test", node["C"].Value <string>());
        }
Beispiel #4
0
        public void MoreComplexTextIsProperlyParsed()
        {
            var actualValue =
                @"Meijin NR: yeah, k4 is won\
derful
sweat NR: thank you! :\)
dada NR: yup. I like this move too. It's a move only to be expected from a pro. I really like it :)
jansteen 4d: Can anyone\
 explain [me\] k4?";
            var expected =
                @"Meijin NR: yeah, k4 is wonderful
sweat NR: thank you! :)
dada NR: yup. I like this move too. It's a move only to be expected from a pro. I really like it :)
jansteen 4d: Can anyone explain [me] k4?";
            var propertyValue = SgfTextValue.Parse(actualValue);
            var actual        = propertyValue.Value;

            TestUtilities.AssertStringEqualityByCharacters(expected, actual);
        }
Beispiel #5
0
        public void SimpleStringWithWhitespaceCanBeParsed()
        {
            var propertyValue = SgfTextValue.Parse("Hello,\t world.");

            Assert.AreEqual("Hello,  world.", propertyValue.Value);
        }
Beispiel #6
0
 public void NullValueCannotBeParsed()
 {
     SgfTextValue.Parse(null);
 }
Beispiel #7
0
 public void NullTextCannotBeCreated()
 {
     var value = new SgfTextValue(null);
 }