Added test coverage for new fluent methods

pull/5073/head
Mathieu Leenhardt 9 years ago
parent ced274861a
commit 9ef407b0d7
  1. 16
      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);

Loading…
Cancel
Save