blob: 67f5faed20cd9703a70986248f5a3c9ae8ab66b0 [file] [log] [blame]
Jan Tattermuschea6cc572017-11-16 18:04:37 +01001#region Copyright notice and license
2
3// Copyright 2016 gRPC authors.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17#endregion
18
19using System;
20using Grpc.Core;
21using Grpc.Testing;
22
23namespace Grpc.IntegrationTesting
24{
25 /// <summary>
26 /// Helpers for Control.cs
27 /// </summary>
28 public static class ControlExtensions
29 {
30 public static ChannelOption ToChannelOption(this ChannelArg channelArgument)
31 {
32 switch (channelArgument.ValueCase)
33 {
34 case ChannelArg.ValueOneofCase.StrValue:
35 return new ChannelOption(channelArgument.Name, channelArgument.StrValue);
36 case ChannelArg.ValueOneofCase.IntValue:
37 return new ChannelOption(channelArgument.Name, channelArgument.IntValue);
38 default:
39 throw new ArgumentException("Unsupported channel argument value.");
40 }
41 }
42 }
43}