Browse Source

Added AnalyzeJSON_NullPath

Piotr Czajkowski 2 years ago
parent
commit
74dc1fe3bc
2 changed files with 16 additions and 1 deletions
  1. 1 1
      analyzeJSON/AnalyzeJSON.cs
  2. 15 0
      analyzeJSONTests/AnalyzeJSONUnitTests.cs

+ 1 - 1
analyzeJSON/AnalyzeJSON.cs

@@ -13,7 +13,7 @@ namespace analyzeJSON
         public AnalyzeJSON(string path)
         {
             if (!File.Exists(path))
-                throw new ArgumentNullException("File doesn't exist!");
+                throw new ArgumentNullException("path");
 
             using StreamReader sr = new StreamReader(path);
             var jsonString = sr.ReadToEnd();

+ 15 - 0
analyzeJSONTests/AnalyzeJSONUnitTests.cs

@@ -0,0 +1,15 @@
+using System;
+using analyzeJSON;
+using Xunit;
+
+namespace analyzeJSONTests
+{
+    public class AnalyzeJSONUnitTests
+    {
+        [Fact]
+        public void AnalyzeJSON_NullPath()
+        {
+            Assert.Throws<ArgumentNullException>(() => new AnalyzeJSON(null));
+        }
+    }
+}