ExtractTextIntegrationTests.cs 904 B

1234567891011121314151617181920212223242526272829303132
  1. using Xunit;
  2. using analyzeJSON;
  3. using System.Collections.Generic;
  4. namespace analyzeJSONTests
  5. {
  6. public class ExtractTextIntegrationTests
  7. {
  8. private static readonly string testFile = @"testFiles/complex.json";
  9. [Fact]
  10. public void ExtractText_withTraverse()
  11. {
  12. var test = new AnalyzeJSON(testFile);
  13. var keys = new Dictionary<string, bool>
  14. {
  15. ["name"] = true,
  16. ["location"] = false
  17. };
  18. var extract = new ExtractText(keys);
  19. var status = test.Traverse((token) => extract.Extract(token));
  20. Assert.True(status.Success);
  21. Assert.Empty(status.Message);
  22. Assert.Equal(2, extract.Result.Count);
  23. Assert.Equal(21, extract.Result["name"].Count);
  24. Assert.Equal(15, extract.Result["location"].Count);
  25. }
  26. }
  27. }