y-crdt / ydotnet

.NET bindings for yrs.
MIT License
36 stars 8 forks source link

YText not supported in Output.To<T> extension method #105

Closed twaddell closed 1 month ago

twaddell commented 2 months ago

The following unit test fails with an "Unsupported data type" message due to Text not being supported in the WriteValue method in YDotNetExtensions.cs

    [Test]
    public void CanParseTextToString()
    {
        // Arrange
        var doc = new Doc();
        var map = doc.Map("map");

        using (var transaction = doc.WriteTransaction())
        {
            map.Insert(transaction, "inner", Input.Map(new Dictionary<string, Input>
            {
                {"value", Input.Text("Hello YDotNet")}
            }));
        }

        using (var transaction = doc.ReadTransaction())
        {
            var inner = map.Get(transaction, "inner");

            // Act
            var parsed = inner.To<Expected>(transaction);

            // Assert
            Assert.That(parsed.Value, Is.EqualTo("Hello YDotNet"));
        }
    }