-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
2 deletions.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace SurrealDb.Tests; | ||
|
||
public class HealthTests | ||
{ | ||
[Theory] | ||
[InlineData("http://localhost:8000")] | ||
[InlineData("ws://localhost:8000/rpc")] | ||
public async Task ShouldBeTrueOnAValidServer(string url) | ||
{ | ||
bool? response = null; | ||
|
||
Func<Task> func = async () => | ||
{ | ||
await using var surrealDbClientGenerator = new SurrealDbClientGenerator(); | ||
var dbInfo = surrealDbClientGenerator.GenerateDatabaseInfo(); | ||
using var client = surrealDbClientGenerator.Create(url); | ||
response = await client.Health(); | ||
}; | ||
|
||
await func.Should().NotThrowAsync(); | ||
|
||
response.Should().BeTrue(); | ||
} | ||
|
||
[Theory] | ||
[InlineData("http://localhost:1234")] | ||
[InlineData("ws://localhost:1234/rpc")] | ||
public async Task ShouldBeFalseOnAnInvalidServer(string url) | ||
{ | ||
bool? response = null; | ||
|
||
Func<Task> func = async () => | ||
{ | ||
await using var surrealDbClientGenerator = new SurrealDbClientGenerator(); | ||
var dbInfo = surrealDbClientGenerator.GenerateDatabaseInfo(); | ||
using var client = surrealDbClientGenerator.Create(url); | ||
response = await client.Health(); | ||
}; | ||
|
||
await func.Should().NotThrowAsync(); | ||
|
||
response.Should().BeFalse(); | ||
} | ||
} |
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,4 +1,3 @@ | ||
using SurrealDb.Internals.Models; | ||
using SurrealDb.Models.Response; | ||
using System.Text; | ||
|
||
|
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
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
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
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
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