Skip to content

Commit

Permalink
- adds unit tests for request info comparer
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Feb 26, 2024
1 parent 7b3942e commit 31e3c43
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/Kiota.Builder.Tests/Manifest/RequestInfoComparerTests.cs
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));
}
}

0 comments on commit 31e3c43

Please sign in to comment.