1 #region Copyright notice and license 2 3 // Copyright 2015 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 19 using System; 20 using Grpc.Core; 21 using Grpc.Core.Internal; 22 using Grpc.Core.Utils; 23 using NUnit.Framework; 24 25 namespace Grpc.Core.Internal.Tests 26 { 27 public class ChannelArgsSafeHandleTest 28 { 29 [Test] CreateEmptyAndDestroy()30 public void CreateEmptyAndDestroy() 31 { 32 var channelArgs = ChannelArgsSafeHandle.Create(0); 33 channelArgs.Dispose(); 34 } 35 36 [Test] CreateNonEmptyAndDestroy()37 public void CreateNonEmptyAndDestroy() 38 { 39 var channelArgs = ChannelArgsSafeHandle.Create(5); 40 channelArgs.Dispose(); 41 } 42 43 [Test] CreateNullAndDestroy()44 public void CreateNullAndDestroy() 45 { 46 var channelArgs = ChannelArgsSafeHandle.CreateNull(); 47 channelArgs.Dispose(); 48 } 49 50 [Test] CreateFillAndDestroy()51 public void CreateFillAndDestroy() 52 { 53 var channelArgs = ChannelArgsSafeHandle.Create(3); 54 channelArgs.SetInteger(0, "somekey", 12345); 55 channelArgs.SetString(1, "somekey", "abcdefghijkl"); 56 channelArgs.SetString(2, "somekey", "XYZ"); 57 channelArgs.Dispose(); 58 } 59 } 60 } 61