-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adds unit tests for request info comparer
Signed-off-by: Vincent Biret <[email protected]>
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
tests/Kiota.Builder.Tests/Manifest/RequestInfoComparerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Kiota.Builder.Manifest; | ||
using Microsoft.OpenApi.ApiManifest; | ||
using Xunit; | ||
|
||
namespace Kiota.Builder.Tests.Manifest; | ||
|
||
public sealed class RequestInfoComparerTests | ||
{ | ||
private readonly RequestInfoComparer _comparer = new(); | ||
[Fact] | ||
public void Defensive() | ||
{ | ||
Assert.Equal(0, _comparer.GetHashCode(null)); | ||
Assert.True(_comparer.Equals(null, null)); | ||
Assert.False(_comparer.Equals(new(), null)); | ||
Assert.False(_comparer.Equals(null, new())); | ||
} | ||
[Fact] | ||
public void GetsHashCode() | ||
{ | ||
Assert.Equal(0, _comparer.GetHashCode(new())); | ||
} | ||
[Fact] | ||
public void Compares() | ||
{ | ||
var requestInfo = new RequestInfo | ||
{ | ||
Method = "get", | ||
UriTemplate = "https://graph.microsoft.com/v1.0/users" | ||
}; | ||
var requestInfo2 = new RequestInfo | ||
{ | ||
Method = "get", | ||
UriTemplate = "https://graph.microsoft.com/v1.0/me" | ||
}; | ||
Assert.False(_comparer.Equals(requestInfo, requestInfo2)); | ||
} | ||
} |