From 9ef407b0d771878ca1c0f35b4554dd64a3492908 Mon Sep 17 00:00:00 2001 From: Mathieu Leenhardt Date: Thu, 4 Feb 2016 23:24:30 +0100 Subject: [PATCH] Added test coverage for new fluent methods --- src/csharp/Grpc.Core.Tests/CallOptionsTest.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/CallOptionsTest.cs b/src/csharp/Grpc.Core.Tests/CallOptionsTest.cs index a3a613be746..99a2d47e6e9 100644 --- a/src/csharp/Grpc.Core.Tests/CallOptionsTest.cs +++ b/src/csharp/Grpc.Core.Tests/CallOptionsTest.cs @@ -54,10 +54,20 @@ namespace Grpc.Core.Tests var deadline = DateTime.UtcNow; Assert.AreEqual(deadline, options.WithDeadline(deadline).Deadline.Value); - var token = new CancellationTokenSource().Token; - Assert.AreEqual(token, options.WithCancellationToken(token).CancellationToken); + var cancellationToken = new CancellationTokenSource().Token; + Assert.AreEqual(cancellationToken, options.WithCancellationToken(cancellationToken).CancellationToken); + + var writeOptions = new WriteOptions(); + Assert.AreSame(writeOptions, options.WithWriteOptions(writeOptions).WriteOptions); + + var propagationToken = new ContextPropagationToken(CallSafeHandle.NullInstance, DateTime.UtcNow, + CancellationToken.None, ContextPropagationOptions.Default); + Assert.AreSame(propagationToken, options.WithPropagationToken(propagationToken).PropagationToken); + + var credentials = new FakeCallCredentials(); + Assert.AreSame(credentials, options.WithCredentials(credentials).Credentials); - // Change original instance is unchanged. + // Check that the original instance is unchanged. Assert.IsNull(options.Headers); Assert.IsNull(options.Deadline); Assert.AreEqual(CancellationToken.None, options.CancellationToken);