Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: third_party/grpc/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #region Copyright notice and license
2
3 // Copyright 2015-2016, Google Inc.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 #endregion
33
34 using System;
35 using System.Collections.Generic;
36 using System.Linq;
37 using System.Threading;
38 using System.Threading.Tasks;
39 using Grpc.Core;
40 using Grpc.Core.Utils;
41 using Grpc.Testing;
42 using NUnit.Framework;
43
44 namespace Grpc.IntegrationTesting
45 {
46 /// <summary>
47 /// Runs interop tests in-process.
48 /// </summary>
49 public class InteropClientServerTest
50 {
51 const string Host = "localhost";
52 Server server;
53 Channel channel;
54 TestService.ITestServiceClient client;
55
56 [TestFixtureSetUp]
57 public void Init()
58 {
59 server = new Server
60 {
61 Services = { TestService.BindService(new TestServiceImpl()) },
62 Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateS slServerCredentials() } }
63 };
64 server.Start();
65
66 var options = new List<ChannelOption>
67 {
68 new ChannelOption(ChannelOptions.SslTargetNameOverride, TestCred entials.DefaultHostOverride)
69 };
70 int port = server.Ports.Single().BoundPort;
71 channel = new Channel(Host, port, TestCredentials.CreateSslCredentia ls(), options);
72 client = TestService.NewClient(channel);
73 }
74
75 [TestFixtureTearDown]
76 public void Cleanup()
77 {
78 channel.ShutdownAsync().Wait();
79 server.ShutdownAsync().Wait();
80 }
81
82 [Test]
83 public void EmptyUnary()
84 {
85 InteropClient.RunEmptyUnary(client);
86 }
87
88 [Test]
89 public void LargeUnary()
90 {
91 InteropClient.RunLargeUnary(client);
92 }
93
94 [Test]
95 public async Task ClientStreaming()
96 {
97 await InteropClient.RunClientStreamingAsync(client);
98 }
99
100 [Test]
101 public async Task ServerStreaming()
102 {
103 await InteropClient.RunServerStreamingAsync(client);
104 }
105
106 [Test]
107 public async Task PingPong()
108 {
109 await InteropClient.RunPingPongAsync(client);
110 }
111
112 [Test]
113 public async Task EmptyStream()
114 {
115 await InteropClient.RunEmptyStreamAsync(client);
116 }
117
118 [Test]
119 public async Task CancelAfterBegin()
120 {
121 await InteropClient.RunCancelAfterBeginAsync(client);
122 }
123
124 [Test]
125 public async Task CancelAfterFirstResponse()
126 {
127 await InteropClient.RunCancelAfterFirstResponseAsync(client);
128 }
129
130 [Test]
131 public async Task TimeoutOnSleepingServer()
132 {
133 await InteropClient.RunTimeoutOnSleepingServerAsync(client);
134 }
135
136 [Test]
137 public async Task CustomMetadata()
138 {
139 await InteropClient.RunCustomMetadataAsync(client);
140 }
141
142 [Test]
143 public async Task StatusCodeAndMessage()
144 {
145 await InteropClient.RunStatusCodeAndMessageAsync(client);
146 }
147
148 [Test]
149 public void UnimplementedMethod()
150 {
151 InteropClient.RunUnimplementedMethod(UnimplementedService.NewClient( channel));
152 }
153 }
154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698