예제 #1
0
        public void AddHeader()
        {
            using (CancellationTokenSource tokenSource = new CancellationTokenSource())
            {
                CallOptions original    = CreateCallOptions(tokenSource.Token);
                CallOptions callOptions = original;

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

                Assert.AreEqual(true, callOptions.ContainsHeader("a"));
                Assert.AreEqual(true, callOptions.ContainsHeader("b"));
                Assert.AreEqual("1", 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);
            }
        }