| Index: third_party/grpc/src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs
|
| diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/third_party/grpc/src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs
|
| similarity index 61%
|
| copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
|
| copy to third_party/grpc/src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs
|
| index e547d834986de8d80703504469e9c39b3d8ae93d..3fa6ad09c02ac7d3dd0acf6abf70d467512751ed 100644
|
| --- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs
|
| +++ b/third_party/grpc/src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs
|
| @@ -1,7 +1,7 @@
|
| #region Copyright notice and license
|
| -// Protocol Buffers - Google's data interchange format
|
| -// Copyright 2008 Google Inc. All rights reserved.
|
| -// https://developers.google.com/protocol-buffers/
|
| +
|
| +// Copyright 2015, Google Inc.
|
| +// All rights reserved.
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,41 +28,50 @@
|
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| +
|
| #endregion
|
|
|
| -namespace Google.Protobuf.Reflection
|
| +using System;
|
| +using System.Threading;
|
| +using System.Threading.Tasks;
|
| +using Grpc.Core;
|
| +using Grpc.Core.Internal;
|
| +using Grpc.Core.Utils;
|
| +using NUnit.Framework;
|
| +
|
| +namespace Grpc.Core.Tests
|
| {
|
| /// <summary>
|
| - /// Represents a package in the symbol table. We use PackageDescriptors
|
| - /// just as placeholders so that someone cannot define, say, a message type
|
| - /// that has the same name as an existing package.
|
| + /// Tests if the version of nunit-console used is sufficient to run async tests.
|
| /// </summary>
|
| - internal sealed class PackageDescriptor : IDescriptor
|
| + public class NUnitVersionTest
|
| {
|
| - private readonly string name;
|
| - private readonly string fullName;
|
| - private readonly FileDescriptor file;
|
| -
|
| - internal PackageDescriptor(string name, string fullName, FileDescriptor file)
|
| - {
|
| - this.file = file;
|
| - this.fullName = fullName;
|
| - this.name = name;
|
| - }
|
| + private int testRunCount = 0;
|
|
|
| - public string Name
|
| + [TestFixtureTearDown]
|
| + public void Cleanup()
|
| {
|
| - get { return name; }
|
| + if (testRunCount != 2)
|
| + {
|
| + Console.Error.WriteLine("You are using and old version of NUnit that doesn't support async tests and skips them instead. " +
|
| + "This test has failed to indicate that.");
|
| + Console.Error.Flush();
|
| + Environment.Exit(1);
|
| + }
|
| }
|
|
|
| - public string FullName
|
| + [Test]
|
| + public void NUnitVersionTest1()
|
| {
|
| - get { return fullName; }
|
| + testRunCount++;
|
| }
|
|
|
| - public FileDescriptor File
|
| + // Old version of NUnit will skip this test
|
| + [Test]
|
| + public async Task NUnitVersionTest2()
|
| {
|
| - get { return file; }
|
| + testRunCount++;
|
| + await Task.Delay(10);
|
| }
|
| }
|
| -}
|
| +}
|
|
|