public void CanCompressSmallStrings() { var traverser = new BlittableJsonTraverser(); using (var ctx = JsonOperationContext.ShortTermSingleUse()) { var input = new DynamicJsonValue { [Constants.Indexing.Fields.DocumentIdFieldName] = "tracks/1", ["Title"] = "A and G motor vehicles" }; using (var inputJson = ctx.ReadObject(input, "input", BlittableJsonDocumentBuilder.UsageMode.CompressSmallStrings)) { var output = new DynamicJsonValue { [Constants.Indexing.Fields.DocumentIdFieldName] = "tracks/1", }; var value = traverser.Read(inputJson, "Title"); output["Title"] = value; using (var outputJson = ctx.ReadObject(output, "output", BlittableJsonDocumentBuilder.UsageMode.CompressSmallStrings)) { Assert.Equal(inputJson.ToString(), outputJson.ToString()); } } } }
public void Reads_simple_value() { var doc = create_doc(new DynamicJsonValue { ["Name"] = "John Doe" }); var read = _sut.Read(doc, "Name"); Assert.Equal("John Doe", read.ToString()); }