diff options
author | Mathieu Leenhardt <mathieu.leenhardt@gmail.com> | 2016-02-04 23:24:30 +0100 |
---|---|---|
committer | Mathieu Leenhardt <mathieu.leenhardt@gmail.com> | 2016-02-04 23:24:30 +0100 |
commit | 9ef407b0d771878ca1c0f35b4554dd64a3492908 (patch) | |
tree | 25dc9f169d249676ffdcff852a59a6e6561fffd4 /src | |
parent | ced274861a469d384fcaedd9cbbc01986033fc67 (diff) |
Added test coverage for new fluent methods
Diffstat (limited to 'src')
-rw-r--r-- | src/csharp/Grpc.Core.Tests/CallOptionsTest.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/csharp/Grpc.Core.Tests/CallOptionsTest.cs b/src/csharp/Grpc.Core.Tests/CallOptionsTest.cs index a3a613be74..99a2d47e6e 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); |