当前位置: 首页>>代码示例>>C#>>正文


C# TestContext.Expect方法代码示例

本文整理汇总了C#中TestContext.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.Expect方法的具体用法?C# TestContext.Expect怎么用?C# TestContext.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestContext的用法示例。


在下文中一共展示了TestContext.Expect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnRun

		protected override void OnRun (TestContext ctx, CancellationToken cancellationToken)
		{
			if (Parameters.ExpectedCipher != null) {
				ctx.Assert (Client.SupportsConnectionInfo, "client supports connection info");
				ctx.Assert (Server.SupportsConnectionInfo, "server supports connection info");

				var clientInfo = Client.GetConnectionInfo ();
				var serverInfo = Server.GetConnectionInfo ();

				if (ctx.Expect (clientInfo, Is.Not.Null, "client connection info"))
					ctx.Expect (clientInfo.CipherCode, Is.EqualTo (Parameters.ExpectedCipher.Value), "client cipher");
				if (ctx.Expect (serverInfo, Is.Not.Null, "server connection info"))
					ctx.Expect (serverInfo.CipherCode, Is.EqualTo (Parameters.ExpectedCipher.Value), "server cipher");
			}

			if (Parameters.ProtocolVersion != null) {
				ctx.Expect (Client.ProtocolVersion, Is.EqualTo (Parameters.ProtocolVersion), "client protocol version");
				ctx.Expect (Server.ProtocolVersion, Is.EqualTo (Parameters.ProtocolVersion), "server protocol version");
			}

			if (Server.Provider.SupportsSslStreams && (Parameters.ServerFlags & ServerFlags.RequireClientCertificate) != 0) {
				ctx.Expect (Server.SslStream.HasRemoteCertificate, "has remote certificate");
				ctx.Expect (Server.SslStream.IsMutuallyAuthenticated, "is mutually authenticated");
			}

			base.OnRun (ctx, cancellationToken);
		}
开发者ID:peterdocter,项目名称:mono-tls,代码行数:27,代码来源:MonoClientAndServerTestRunner.cs

示例2: ExpectBlob

		protected async Task ExpectBlob (TestContext ctx, ICommonConnection connection, HandshakeInstrumentType type, CancellationToken cancellationToken)
		{
			cancellationToken.ThrowIfCancellationRequested ();

			LogDebug (ctx, 2, "ExpectBlob", connection, type);

			var buffer = new byte [4096];
			var blob = Instrumentation.GetTextBuffer (type);
			var ret = await connection.Stream.ReadAsync (buffer, 0, buffer.Length, cancellationToken);

			LogDebug (ctx, 2, "ExpectBlob #1", connection, type, ret);

			if (ctx.Expect (ret, Is.GreaterThan (0), "read success")) {
				var result = new BufferOffsetSize (buffer, 0, ret);

				ctx.Expect (result, new IsEqualBlob (blob), "blob");
			}

			LogDebug (ctx, 2, "ExpectBlob done", connection, type);
		}
开发者ID:VimalKumarS,项目名称:mono-tls,代码行数:20,代码来源:InstrumentationConnectionHandler.cs


注:本文中的TestContext.Expect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。