Reformat/cleanup
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ZB.MOM.WW.CBDDC.Core;
|
||||
using ZB.MOM.WW.CBDDC.Core.Network;
|
||||
using ZB.MOM.WW.CBDDC.Core.Storage;
|
||||
using ZB.MOM.WW.CBDDC.Network.Security;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
||||
namespace ZB.MOM.WW.CBDDC.Network.Tests;
|
||||
|
||||
public class HandshakeRegressionTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that the server invokes the handshake service when a client connects.
|
||||
/// Verifies that the server invokes the handshake service when a client connects.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task Server_Should_Call_HandshakeService_On_Client_Connection()
|
||||
@@ -22,9 +21,11 @@ public class HandshakeRegressionTests
|
||||
.Returns(new HlcTimestamp(0, 0, "node"));
|
||||
oplogStore.GetVectorClockAsync(Arg.Any<CancellationToken>())
|
||||
.Returns(new VectorClock());
|
||||
oplogStore.GetOplogAfterAsync(Arg.Any<HlcTimestamp>(), Arg.Any<IEnumerable<string>?>(), Arg.Any<CancellationToken>())
|
||||
oplogStore.GetOplogAfterAsync(Arg.Any<HlcTimestamp>(), Arg.Any<IEnumerable<string>?>(),
|
||||
Arg.Any<CancellationToken>())
|
||||
.Returns(Array.Empty<OplogEntry>());
|
||||
oplogStore.GetOplogForNodeAfterAsync(Arg.Any<string>(), Arg.Any<HlcTimestamp>(), Arg.Any<IEnumerable<string>?>(), Arg.Any<CancellationToken>())
|
||||
oplogStore.GetOplogForNodeAfterAsync(Arg.Any<string>(), Arg.Any<HlcTimestamp>(),
|
||||
Arg.Any<IEnumerable<string>?>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Array.Empty<OplogEntry>());
|
||||
|
||||
var configProvider = Substitute.For<IPeerNodeConfigurationProvider>();
|
||||
@@ -44,7 +45,8 @@ public class HandshakeRegressionTests
|
||||
authenticator.ValidateAsync(Arg.Any<string>(), Arg.Any<string>()).Returns(true);
|
||||
|
||||
var handshakeService = Substitute.For<IPeerHandshakeService>();
|
||||
handshakeService.HandshakeAsync(Arg.Any<Stream>(), Arg.Any<bool>(), Arg.Any<string>(), Arg.Any<CancellationToken>())
|
||||
handshakeService.HandshakeAsync(Arg.Any<Stream>(), Arg.Any<bool>(), Arg.Any<string>(),
|
||||
Arg.Any<CancellationToken>())
|
||||
.Returns((CipherState?)null);
|
||||
|
||||
var server = new TcpSyncServer(
|
||||
@@ -57,7 +59,7 @@ public class HandshakeRegressionTests
|
||||
handshakeService);
|
||||
|
||||
await server.Start();
|
||||
var port = server.ListeningPort ?? throw new Exception("Server did not start or report port");
|
||||
int port = server.ListeningPort ?? throw new Exception("Server did not start or report port");
|
||||
|
||||
// Act
|
||||
using (var client = new TcpClient())
|
||||
@@ -72,4 +74,4 @@ public class HandshakeRegressionTests
|
||||
await handshakeService.Received(1)
|
||||
.HandshakeAsync(Arg.Any<Stream>(), false, "server-node", Arg.Any<CancellationToken>());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user