|
@@ -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));
|
|
|
+ }
|
|
|
}
|
|
|
}
|