-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add unit-tests for QueryIdProvider
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
global using Atc.Kusto.Extensions.Internal; | ||
global using Atc.Kusto.Extensions.Internal; | ||
global using Atc.Kusto.Providers.Internal; |
33 changes: 33 additions & 0 deletions
33
test/Atc.Kusto.Tests/Providers/Internal/QueryIdProviderTests.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,33 @@ | ||
namespace Atc.Kusto.Tests.Providers.Internal; | ||
|
||
public sealed class QueryIdProviderTests | ||
{ | ||
private readonly QueryIdProvider sut = new(); | ||
|
||
[Theory, AutoNSubstituteData] | ||
public void Create_WithValidSessionId_ReturnsExpectedQueryId( | ||
Type queryType, | ||
string sessionId) | ||
{ | ||
// Arrange & Act | ||
var actual = sut.Create(queryType, sessionId); | ||
|
||
// Assert | ||
actual | ||
.Should() | ||
.Be($"{queryType.Name}{sessionId.ToAlphaNumeric()}"); | ||
} | ||
|
||
[Theory, AutoNSubstituteData] | ||
public void Create_WithNullSessionId_ReturnsQueryIdWithNewGuid( | ||
Type queryType) | ||
{ | ||
// Arrange & Act | ||
var actual = sut.Create(queryType, sessionId: null); | ||
|
||
// Assert | ||
actual | ||
.Should().StartWith(queryType.Name) | ||
.And.HaveLength(queryType.Name.Length + Guid.NewGuid().ToString("N").Length); | ||
} | ||
} |