Skip to content

Commit

Permalink
add unit tests for HttpPathSegmenter
Browse files Browse the repository at this point in the history
  • Loading branch information
koros committed Nov 21, 2024
1 parent 0c7e0ee commit 41345d5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/Kiota.Builder.Tests/PathSegmenters/HttpPathSegmenterTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Kiota.Builder.CodeDOM;
using Kiota.Builder.PathSegmenters;
using Xunit;

namespace Kiota.Builder.Tests.PathSegmenters
{
public class HttpPathSegmenterTests
{
private readonly HttpPathSegmenter segmenter;

public HttpPathSegmenterTests()
{
segmenter = new HttpPathSegmenter("D:\\source\\repos\\kiota-sample", "client");
}

[Fact]
public void HttpPathSegmenterGeneratesCorrectFileName()
{
var fileName = segmenter.NormalizeFileName(new CodeClass
{
Name = "testClass"
});
Assert.Equal("TestClass", fileName);// the file name should be Proper case
}

[Fact]
public void HttpPathSegmenterGeneratesNamespaceFolderName()
{
var namespaceName = "microsoft.Graph";
var normalizedNamespace = segmenter.NormalizeNamespaceSegment(namespaceName);
Assert.Equal("Microsoft.Graph", normalizedNamespace);// the first character is upper case
}
}
}

0 comments on commit 41345d5

Please sign in to comment.