本文整理汇总了C#中TestContext.LogMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.LogMessage方法的具体用法?C# TestContext.LogMessage怎么用?C# TestContext.LogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestContext
的用法示例。
在下文中一共展示了TestContext.LogMessage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
protected override async Task<MonoSslStream> Start (TestContext ctx, Socket socket, MSI.MonoTlsSettings settings, CancellationToken cancellationToken)
{
ctx.LogMessage ("Accepted connection from {0}.", socket.RemoteEndPoint);
var stream = new NetworkStream (socket);
var server = await ConnectionProvider.CreateServerStreamAsync (stream, Parameters, settings, cancellationToken);
ctx.LogMessage ("Successfully authenticated server.");
return server;
}
示例2: Start
protected override async Task<MonoSslStream> Start (TestContext ctx, Stream stream, MSI.MonoTlsSettings settings, CancellationToken cancellationToken)
{
ctx.LogMessage ("Connected.");
var targetHost = Parameters.TargetHost ?? EndPoint.HostName ?? EndPoint.Address;
ctx.LogDebug (1, "Using '{0}' as target host.", targetHost);
var client = await ConnectionProvider.CreateClientStreamAsync (stream, targetHost, Parameters, settings, cancellationToken);
ctx.LogMessage ("Successfully authenticated client.");
return client;
}
示例3: Start
protected override async Task<MonoSslStream> Start (TestContext ctx, Stream stream, MSI.MonoTlsSettings settings, CancellationToken cancellationToken)
{
var server = await ConnectionProvider.CreateServerStreamAsync (stream, Parameters, settings, cancellationToken);
ctx.LogMessage ("Successfully authenticated server.");
return server;
}
示例4: Shutdown
public sealed override Task<bool> Shutdown (TestContext ctx, bool attemptCleanShutdown, CancellationToken cancellationToken)
{
return Task.Run (() => {
ctx.LogMessage ("{0} shutdown: {1}", this, attemptCleanShutdown);
return openssl.Shutdown (attemptCleanShutdown);
});
}
示例5: Start
public sealed override Task Start (TestContext ctx, CancellationToken cancellationToken)
{
var protocol = GetProtocolVersion ();
ctx.LogMessage ("Starting {0} version {1}.", this, protocol);
openssl = new NativeOpenSsl (IsServer, false, protocol);
var validationCallback = GetValidationCallback ();
openssl.SetCertificateVerify (NativeOpenSsl.VerifyMode.SSL_VERIFY_PEER, validationCallback);
Initialize ();
Task.Factory.StartNew (() => {
try {
CreateConnection ();
createTcs.SetResult (null);
} catch (Exception ex) {
createTcs.SetException (ex);
}
});
return FinishedTask;
}
示例6: RunMainLoopMartin
async Task RunMainLoopMartin (TestContext ctx, CancellationToken cancellationToken)
{
ctx.LogMessage ("MAIN LOOP MARTIN");
var buffer = new byte [4096];
int ret = await Server.Stream.ReadAsync (buffer, 0, buffer.Length);
ctx.LogMessage ("MAIN LOOP MARTIN #1: {0}", ret);
DebugHelper.WriteBuffer ("READ", buffer, 0, ret);
// await Server.Shutdown (ctx, true, true, cancellationToken);
// ctx.LogMessage ("MAIN LOOP MARTIN #2");
var secondRead = Server.Stream.ReadAsync (buffer, 0, buffer.Length);
await Task.Delay (1500);
await Client.Shutdown (ctx, true, cancellationToken);
ret = await secondRead;
ctx.LogMessage ("MAIN LOOP MARTIN #2: {0}", ret);
}
示例7: Shutdown
public sealed override Task<bool> Shutdown (TestContext ctx, CancellationToken cancellationToken)
{
ctx.LogMessage ("{0} shutdown", this);
return Task.Factory.FromAsync (openssl.BeginShutdown, openssl.EndShutdown, true, null);
}
示例8: RunWithManualClient
async Task RunWithManualClient (TestContext ctx, CancellationToken cancellationToken)
{
ctx.LogMessage ("MANUAL CLIENT");
var serverStream = new StreamWrapper (Server.Stream);
await serverStream.WriteLineAsync ("Hello World!");
ctx.LogMessage ("WAITING FOR CLIENT INPUT");
var line = await serverStream.ReadLineAsync ();
ctx.LogMessage ("GOT CLIENT MESSAGE: {0}", line);
await Shutdown (ctx, SupportsCleanShutdown, true, cancellationToken);
}
示例9: RunWithManualServer
async Task RunWithManualServer (TestContext ctx, CancellationToken cancellationToken)
{
var clientStream = new StreamWrapper (Client.Stream);
ctx.LogMessage ("WRITING REQUEST: {0}", Parameters.ClientParameters.TargetHost ?? "<null>");
await clientStream.WriteLineAsync ("GET / HTTP/1.0");
try {
if (Parameters.ClientParameters.TargetHost != null)
await clientStream.WriteLineAsync (string.Format ("Host: {0}", Parameters.ClientParameters.TargetHost));
await clientStream.WriteLineAsync ();
} catch (Exception ex) {
ctx.LogMessage ("RECEIVED EXCEPTION WHILE WRITING REQUEST: {0}", ex.Message);
}
var line = await clientStream.ReadLineAsync ();
ctx.LogMessage ("GOT RESPONSE: {0}", line);
HttpProtocol protocol;
HttpStatusCode status;
if (!HttpResponse.ParseResponseHeader (line, out protocol, out status))
throw new ConnectionException ("Got unexpected output from server: '{0}'", line);
ctx.LogMessage ("GOT RESPONSE: {0} {1}", protocol, status);
await Shutdown (ctx, SupportsCleanShutdown, true, cancellationToken);
}