Scaffolded c# app
This commit is contained in:
parent
0272c5ac3a
commit
387a6ac182
57 changed files with 3930 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
using Surveillance.Client.Domain;
|
||||
using Xunit;
|
||||
|
||||
namespace Surveillance.Client.Domain.Tests;
|
||||
|
||||
public sealed class DeviceEndpointTests
|
||||
{
|
||||
[Fact]
|
||||
public void CredentialKeyIsStableAcrossHostCaseAndWhitespace()
|
||||
{
|
||||
var first = new DeviceEndpoint(" camera.local ", 34567);
|
||||
var second = new DeviceEndpoint("CAMERA.local", 34567);
|
||||
|
||||
Assert.Equal(first.CredentialKey, second.CredentialKey);
|
||||
Assert.Equal("camera.local:34567", first.ToString());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)]
|
||||
[InlineData(65536)]
|
||||
public void RejectsPortsOutsideTcpRange(int port)
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new DeviceEndpoint("127.0.0.1", port));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CredentialsNeverExposeTheirValuesInToString()
|
||||
{
|
||||
var credentials = new DeviceCredentials("viewer", "a-secret-value");
|
||||
|
||||
Assert.DoesNotContain("viewer", credentials.ToString(), StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("a-secret-value", credentials.ToString(), StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue