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


C# RuntimePipeline.InvokeSync方法代码示例

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


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

示例1: TestSignerWithAnonymousCredentials

        public void TestSignerWithAnonymousCredentials()
        {            
            var pipeline = new RuntimePipeline(new MockHandler());
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new AnonymousAWSCredentials()));

            var context = CreateTestContext();
            var signer = new MockSigner();
            ((RequestContext)context.RequestContext).Signer = signer;
            pipeline.InvokeSync(context);

            Assert.IsTrue(context.RequestContext.IsSigned);
            Assert.AreEqual(0, signer.SignCount);
        }
开发者ID:nataren,项目名称:aws-sdk-net,代码行数:14,代码来源:SignerTests.cs

示例2: TestSignerWithBasicCredentials

        public void TestSignerWithBasicCredentials()
        {
            var pipeline = new RuntimePipeline(new MockHandler());            
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey")));

            var context = CreateTestContext();
            var signer = new MockSigner();
            ((RequestContext)context.RequestContext).Signer = signer;
            pipeline.InvokeSync(context);

            Assert.IsTrue(context.RequestContext.IsSigned);
            Assert.AreEqual(1, signer.SignCount);
        }
开发者ID:nataren,项目名称:aws-sdk-net,代码行数:14,代码来源:SignerTests.cs

示例3: TestSignerWithMutableHeader

        public void TestSignerWithMutableHeader()
        {
            var pipeline = new RuntimePipeline(new MockHandler());           
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey")));

            var context = CreateTestContext();
            var signer = new AWS4Signer();
            ((RequestContext)context.RequestContext).Signer = signer;

            // inject a mutable header that the signer should strip out
            context.RequestContext.Request.Headers[HeaderKeys.XAmznTraceIdHeader] = "stuff";
            pipeline.InvokeSync(context);

            // verify that the header is not in the signature
            var t = context.RequestContext.Request.Headers[HeaderKeys.AuthorizationHeader];
            Assert.IsFalse(t.Contains(HeaderKeys.XAmznTraceIdHeader));

            Assert.IsTrue(context.RequestContext.Request.Headers.ContainsKey(HeaderKeys.XAmznTraceIdHeader));
        }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:20,代码来源:SignerTests.cs


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