Browse Source

Added TwoActionsAtOnce

Piotr Czajkowski 1 year ago
parent
commit
4ee5a3c0e5
1 changed files with 27 additions and 1 deletions
  1. 27 1
      analyzeJSONTests/AnalyzeJSONIntegrationTests.cs

+ 27 - 1
analyzeJSONTests/AnalyzeJSONIntegrationTests.cs

@@ -1,5 +1,8 @@
-using analyzeJSON;
+using analyzeJSON;
 using Xunit;
+using System;
+using System.Collections.Generic;
+using Newtonsoft.Json.Linq;
 
 namespace analyzeJSONTests
 {
@@ -11,6 +14,29 @@ namespace analyzeJSONTests
         public void AnalyzeJSON_AllGood()
         {
             _ = new AnalyzeJSON(testFile);
+        }
+
+				[Fact]
+        public void TwoActionsAtOnce()
+        {
+            var test = new AnalyzeJSON(testFile);
+            var analyze = new AnalyzeStructure();
+						var stats = new Statistics();
+
+						var actions = new List<Action<JToken>> {
+							analyze.AnalyzeToken,
+							stats.RunStatistics
+						};
+            var status = test.Traverse(actions);
+            Assert.True(status.Success);
+            Assert.Empty(status.Message);
+
+            var result = analyze.Result;
+            Assert.Equal(10, result.Nodes.Count);
+            Assert.Equal(11, result.Leafs.Count);
+	
+            Assert.Equal(11, stats.Result.NodeCounts.Count);
+            Assert.Equal(168, stats.Result.TotalWordCount);
         }
     }
 }