Browse Source

Added GetNameFromPath_DifferentCases

Piotr Czajkowski 2 years ago
parent
commit
03670a4d4b
1 changed files with 19 additions and 0 deletions
  1. 19 0
      analyzeJSONTests/AnalyzeJSONUnitTests.cs

+ 19 - 0
analyzeJSONTests/AnalyzeJSONUnitTests.cs

@@ -1,9 +1,12 @@
 using System;
+using System.Collections.Generic;
 using analyzeJSON;
 using Xunit;
 
 namespace analyzeJSONTests
 {
+    public record TestCase(string Input, string ExpectedOutput);
+
     public class AnalyzeJSONUnitTests
     {
         [Fact]
@@ -23,5 +26,21 @@ namespace analyzeJSONTests
         {
             Assert.Empty(AnalyzeJSON.GetNameFromPath(string.Empty));
         }
+
+        [Fact]
+        public void GetNameFromPath_DifferentCases()
+        {
+            var testCases = new List<TestCase>
+            {
+                new TestCase("abc", "abc"),
+                new TestCase("abc.def", "def"),
+                new TestCase("abc.", string.Empty),
+                new TestCase("abc.def.", string.Empty),
+
+            };
+
+            foreach (var testCase in testCases)
+                Assert.Equal(testCase.ExpectedOutput, AnalyzeJSON.GetNameFromPath(testCase.Input));
+        }
     }
 }