public void ReadLinkTokenWithTextDescription_When(string description, string link)
        {
            var expectedToken = new LinkToken(new List <IToken> {
                new TextToken(description)
            }, link);

            var(token, _) = defaultReader.ReadToken($"[{description}]({link})", 0, options);

            token.Should().Be(expectedToken);
        }
Example #2
0
        private LinkToken[] GetLinkTokens(object data, SchemaMember member)
        {
            if (member == null || member.Token.Property.IsSimplex)
            {
                return(Array.Empty <LinkToken>());
            }

            var complex = (IDataEntityComplexProperty)member.Token.Property;
            var tokens  = new LinkToken[complex.Links.Length];

            for (int i = 0; i < complex.Links.Length; i++)
            {
                var link    = complex.Links[i];
                var anchors = link.GetAnchors();

                if (anchors.Length > 1)
                {
                    throw new DataException($"The '{member.FullPath}' multi-level link anchors are not supported in mutate operation.");
                }

                if (Utility.TryGetMemberValue(ref data, anchors[0].Name, out var value))