示例#1
0
        public void SetHeader()
        {
            using (CancellationTokenSource tokenSource = new CancellationTokenSource())
            {
                CallOptions original    = CreateCallOptions(tokenSource.Token);
                CallOptions callOptions = original;

                callOptions = callOptions.SetHeader("a", "0");
                callOptions = callOptions.SetHeader("b", "1");

                Assert.AreEqual(true, callOptions.ContainsHeader("a"));
                Assert.AreEqual(true, callOptions.ContainsHeader("b"));
                Assert.AreEqual("0", callOptions.Headers.GetStringValueOrNull("a"));

                Assert.AreEqual(original.WriteOptions, callOptions.WriteOptions);
                Assert.AreEqual(original.CancellationToken, callOptions.CancellationToken);
                Assert.AreEqual(original.PropagationToken, callOptions.PropagationToken);
                Assert.AreEqual(original.Credentials, callOptions.Credentials);
            }
        }