|
|
@ -54,10 +54,20 @@ namespace Grpc.Core.Tests |
|
|
|
var deadline = DateTime.UtcNow; |
|
|
|
var deadline = DateTime.UtcNow; |
|
|
|
Assert.AreEqual(deadline, options.WithDeadline(deadline).Deadline.Value); |
|
|
|
Assert.AreEqual(deadline, options.WithDeadline(deadline).Deadline.Value); |
|
|
|
|
|
|
|
|
|
|
|
var token = new CancellationTokenSource().Token; |
|
|
|
var cancellationToken = new CancellationTokenSource().Token; |
|
|
|
Assert.AreEqual(token, options.WithCancellationToken(token).CancellationToken); |
|
|
|
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.Headers); |
|
|
|
Assert.IsNull(options.Deadline); |
|
|
|
Assert.IsNull(options.Deadline); |
|
|
|
Assert.AreEqual(CancellationToken.None, options.CancellationToken); |
|
|
|
Assert.AreEqual(CancellationToken.None, options.CancellationToken); |
|
|
|