Skip to content
Snippets Groups Projects
Commit a7ca8668 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

add test for shuttingdown event

parent ae607078
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
using System;
using System.Linq;
using System.Threading;
using Grpc.Core;
using NUnit.Framework;
......@@ -75,5 +76,19 @@ namespace Grpc.Core.Tests
var parts = coreVersion.Split('.');
Assert.AreEqual(3, parts.Length);
}
[Test]
public void ShuttingDownEventIsFired()
{
var cts = new CancellationTokenSource();
var handler = new EventHandler((sender, args) => { cts.Cancel(); });
GrpcEnvironment.ShuttingDown += handler;
var env = GrpcEnvironment.AddRef();
GrpcEnvironment.ReleaseAsync().Wait();
GrpcEnvironment.ShuttingDown -= handler;
Assert.IsTrue(cts.Token.IsCancellationRequested);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment