AnalyzeStructureUnitTests.cs 716 B

12345678910111213141516171819202122232425262728
  1. using Xunit;
  2. using analyzeJSON;
  3. using Newtonsoft.Json.Linq;
  4. namespace analyzeJSONTests
  5. {
  6. public class AnalyzeStructureUnitTests
  7. {
  8. [Fact]
  9. public void AnalyzeToken_AllGood()
  10. {
  11. dynamic token = new JObject();
  12. token.text = "something";
  13. var leaf = token["text"];
  14. var node = new JProperty("prop", JToken.Parse(@"{ ""text"" : ""lorem"", ""text2"" : ""ipsum"" }"));
  15. var analyze = new AnalyzeStructure();
  16. analyze.AnalyzeToken(leaf);
  17. analyze.AnalyzeToken(node);
  18. var result = analyze.Result;
  19. Assert.Single(result.Nodes);
  20. Assert.Single(result.Leafs);
  21. }
  22. }
  23. }