public void MethodValues3ResourceNames() { moq::Mock <UnitTests.UnitTestsClient> mockGrpcClient = new moq::Mock <UnitTests.UnitTestsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ValuesRequest request = new ValuesRequest { SingleResourceNameAsAResourceName = AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), RepeatedResourceNameAsAResourceNames = { AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), }, SingleWildcardResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), RepeatedWildcardResourceAsResourceNames = { new gax::UnparsedResourceName("a/wildcard/resource"), }, MultiPatternResourceNameAsMultiPatternResourceName = MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), RepeatedMultiPatternResourceNameAsMultiPatternResourceNames = { MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), }, }; Response expectedResponse = new Response { }; mockGrpcClient.Setup(x => x.MethodValues(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); UnitTestsClient client = new UnitTestsClientImpl(mockGrpcClient.Object, null); Response response = client.MethodValues(request.SingleResourceNameAsAResourceName, request.RepeatedResourceNameAsAResourceNames, request.SingleWildcardResourceAsResourceName, request.RepeatedWildcardResourceAsResourceNames, request.MultiPatternResourceNameAsMultiPatternResourceName, request.RepeatedMultiPatternResourceNameAsMultiPatternResourceNames); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for MethodDefaultValues</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MethodDefaultValuesResourceNames() { // Create client SnippetsClient snippetsClient = SnippetsClient.Create(); // Initialize request argument(s) IEnumerable <double> repeatedDouble = new double[] { 0, }; IEnumerable <DefaultValuesRequest.Types.NestedMessage> repeatedNestedMessage = new DefaultValuesRequest.Types.NestedMessage[] { new DefaultValuesRequest.Types.NestedMessage(), }; IEnumerable <AResourceName> repeatedResourceName = new AResourceName[] { AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), }; // Make the request Response response = snippetsClient.MethodDefaultValues(repeatedDouble, repeatedNestedMessage, repeatedResourceName); }
public async stt::Task MethodValues2ResourceNamesAsync() { moq::Mock <UnitTests.UnitTestsClient> mockGrpcClient = new moq::Mock <UnitTests.UnitTestsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ValuesRequest request = new ValuesRequest { SingleDouble = -1.076317236333089E+18, SingleFloat = 9.844708E+17F, SingleInt32 = 1006714422, SingleInt64 = 7588944567505710014L, RepeatedBool = { true, }, RepeatedBytes = { proto::ByteString.CopyFromUtf8("repeated_bytes6e9b8178"), }, RepeatedResourceNameAsAResourceNames = { AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), }, MapIntString = { { -1978962372, "value60c16320" }, }, SingleWrappedString = "single_wrapped_stringf548cb82", RepeatedWrappedDouble = { 9.728582718428364E+17, }, }; Response expectedResponse = new Response { }; mockGrpcClient.Setup(x => x.MethodValuesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Response>(stt::Task.FromResult(expectedResponse), null, null, null, null)); UnitTestsClient client = new UnitTestsClientImpl(mockGrpcClient.Object, null); Response responseCallSettings = await client.MethodValuesAsync(request.SingleDouble, request.SingleFloat, request.SingleInt32, request.SingleInt64, request.RepeatedBool, request.RepeatedBytes, request.RepeatedResourceNameAsAResourceNames, request.MapIntString, request.SingleWrappedString, request.RepeatedWrappedDouble, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Response responseCancellationToken = await client.MethodValuesAsync(request.SingleDouble, request.SingleFloat, request.SingleInt32, request.SingleInt64, request.RepeatedBool, request.RepeatedBytes, request.RepeatedResourceNameAsAResourceNames, request.MapIntString, request.SingleWrappedString, request.RepeatedWrappedDouble, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task MethodValues3ResourceNamesAsync() { moq::Mock <UnitTests.UnitTestsClient> mockGrpcClient = new moq::Mock <UnitTests.UnitTestsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ValuesRequest request = new ValuesRequest { SingleResourceNameAsAResourceName = AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), RepeatedResourceNameAsAResourceNames = { AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), }, SingleWildcardResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), RepeatedWildcardResourceAsResourceNames = { new gax::UnparsedResourceName("a/wildcard/resource"), }, MultiPatternResourceNameAsMultiPatternResourceName = MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), RepeatedMultiPatternResourceNameAsMultiPatternResourceNames = { MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), }, }; Response expectedResponse = new Response { }; mockGrpcClient.Setup(x => x.MethodValuesAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Response>(stt::Task.FromResult(expectedResponse), null, null, null, null)); UnitTestsClient client = new UnitTestsClientImpl(mockGrpcClient.Object, null); Response responseCallSettings = await client.MethodValuesAsync(request.SingleResourceNameAsAResourceName, request.RepeatedResourceNameAsAResourceNames, request.SingleWildcardResourceAsResourceName, request.RepeatedWildcardResourceAsResourceNames, request.MultiPatternResourceNameAsMultiPatternResourceName, request.RepeatedMultiPatternResourceNameAsMultiPatternResourceNames, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Response responseCancellationToken = await client.MethodValuesAsync(request.SingleResourceNameAsAResourceName, request.RepeatedResourceNameAsAResourceNames, request.SingleWildcardResourceAsResourceName, request.RepeatedWildcardResourceAsResourceNames, request.MultiPatternResourceNameAsMultiPatternResourceName, request.RepeatedMultiPatternResourceNameAsMultiPatternResourceNames, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for MethodDefaultValuesAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task MethodDefaultValuesRequestObjectAsync() { // Create client SnippetsClient snippetsClient = await SnippetsClient.CreateAsync(); // Initialize request argument(s) DefaultValuesRequest request = new DefaultValuesRequest { SingleDouble = 0, SingleFloat = 0F, SingleInt32 = 0, SingleInt64 = 0L, SingleUint32 = 0U, SingleUint64 = 0UL, SingleSint32 = 0, SingleSint64 = 0L, SingleFixed32 = 0U, SingleFixed64 = 0UL, SingleSfixed32 = 0, SingleSfixed64 = 0L, SingleBool = false, SingleString = "", SingleBytes = ByteString.Empty, SingleMessage = new AnotherMessage(), SingleNestedMessage = new DefaultValuesRequest.Types.NestedMessage(), SingleEnum = Enum.Default, SingleNestedEnum = DefaultValuesRequest.Types.NestedEnum.DefaultValue, RepeatedDouble = { 0, }, RepeatedFloat = { 0F, }, RepeatedInt32 = { 0, }, RepeatedInt64 = { 0L, }, RepeatedUint32 = { 0U, }, RepeatedUint64 = { 0UL, }, RepeatedSint32 = { 0, }, RepeatedSint64 = { 0L, }, RepeatedFixed32 = { 0U, }, RepeatedFixed64 = { 0UL, }, RepeatedSfixed32 = { 0, }, RepeatedSfixed64 = { 0L, }, RepeatedBool = { false, }, RepeatedString = { "", }, RepeatedBytes = { ByteString.Empty, }, RepeatedMessage = { new AnotherMessage(), }, RepeatedNestedMessage = { new DefaultValuesRequest.Types.NestedMessage(), }, RepeatedEnum = { Enum.Default, }, RepeatedNestedEnum = { DefaultValuesRequest.Types.NestedEnum.DefaultValue, }, SingleResourceNameAsAResourceName = AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), RepeatedResourceNameAsAResourceNames = { AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), }, SingleWildcardResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"), RepeatedWildcardResourceAsResourceNames = { new UnparsedResourceName("a/wildcard/resource"), }, MultiPatternResourceNameAsMultiPatternResourceName = MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), RepeatedMultiPatternResourceNameAsMultiPatternResourceNames = { MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), }, MapIntString = { { 0, "" }, }, SingleWrappedDouble = 0, SingleWrappedFloat = 0F, SingleWrappedInt64 = 0L, SingleWrappedUint64 = 0UL, SingleWrappedInt32 = 0, SingleWrappedUint32 = 0U, SingleWrappedBool = false, SingleWrappedString = "", SingleWrappedBytes = ByteString.Empty, RepeatedWrappedDouble = { 0, }, RepeatedWrappedFloat = { 0F, }, RepeatedWrappedInt64 = { 0L, }, RepeatedWrappedUint64 = { 0UL, }, RepeatedWrappedInt32 = { 0, }, RepeatedWrappedUint32 = { 0U, }, RepeatedWrappedBool = { false, }, RepeatedWrappedString = { "", }, RepeatedWrappedBytes = { ByteString.Empty, }, }; // Make the request Response response = await snippetsClient.MethodDefaultValuesAsync(request); }
public void MethodValuesRequestObject() { moq::Mock <UnitTests.UnitTestsClient> mockGrpcClient = new moq::Mock <UnitTests.UnitTestsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ValuesRequest request = new ValuesRequest { SingleDouble = -1.076317236333089E+18, SingleFloat = 9.844708E+17F, SingleInt32 = 1006714422, SingleInt64 = 7588944567505710014L, SingleUint32 = 1126406589U, SingleUint64 = 17485030504044489760UL, SingleSint32 = -1352705621, SingleSint64 = 2082867308710527737L, SingleFixed32 = 4173946396U, SingleFixed64 = 11184033605403130352UL, SingleSfixed32 = 1276562217, SingleSfixed64 = -6081914353897584723L, SingleBool = false, SingleString = "single_string96cd7d30", SingleBytes = proto::ByteString.CopyFromUtf8("single_bytes7f9384e7"), SingleMessage = new AnotherMessage(), SingleNestedMessage = new ValuesRequest.Types.NestedMessage(), SingleEnum = Enum.Default, SingleNestedEnum = ValuesRequest.Types.NestedEnum.Default, RepeatedDouble = { -4.520890254992539E+17, }, RepeatedFloat = { -1.0048845E+18F, }, RepeatedInt32 = { -2077149597, }, RepeatedInt64 = { 7687316919822141708L, }, RepeatedUint32 = { 603035763U, }, RepeatedUint64 = { 17209126530695563676UL, }, RepeatedSint32 = { 2039757871, }, RepeatedSint64 = { -620817012101130427L, }, RepeatedFixed32 = { 2635338237U, }, RepeatedFixed64 = { 3059281051678551290UL, }, RepeatedSfixed32 = { -1293299539, }, RepeatedSfixed64 = { 4598468037304457802L, }, RepeatedBool = { true, }, RepeatedString = { "repeated_string60f8764e", }, RepeatedBytes = { proto::ByteString.CopyFromUtf8("repeated_bytes6e9b8178"), }, RepeatedMessage = { new AnotherMessage(), }, RepeatedNestedMessage = { new ValuesRequest.Types.NestedMessage(), }, RepeatedEnum = { Enum.Default, }, RepeatedNestedEnum = { ValuesRequest.Types.NestedEnum.Default, }, SingleResourceNameAsAResourceName = AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), RepeatedResourceNameAsAResourceNames = { AResourceName.FromItemPart("[ITEM_ID]", "[PART_ID]"), }, SingleWildcardResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), RepeatedWildcardResourceAsResourceNames = { new gax::UnparsedResourceName("a/wildcard/resource"), }, MultiPatternResourceNameAsMultiPatternResourceName = MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), RepeatedMultiPatternResourceNameAsMultiPatternResourceNames = { MultiPatternResourceName.FromRootAItem("[ROOT_A_ID]", "[ITEM_ID]"), }, MapIntString = { { -1978962372, "value60c16320" }, }, #pragma warning disable CS0612 ObsoleteField = "obsolete_field3c966e0f", #pragma warning restore CS0612 SingleWrappedDouble = 22839531535779308, SingleWrappedFloat = -1.1280357E+18F, SingleWrappedInt64 = 5539411588513130608L, SingleWrappedUint64 = 16318141618769028113UL, SingleWrappedInt32 = -162124917, SingleWrappedUint32 = 185702015U, SingleWrappedBool = false, SingleWrappedString = "single_wrapped_stringf548cb82", SingleWrappedBytes = proto::ByteString.CopyFromUtf8("single_wrapped_bytesd1603531"), SingleStruct = new wkt::Struct(), RepeatedWrappedDouble = { 9.728582718428364E+17, }, RepeatedWrappedFloat = { 1.118602E+18F, }, RepeatedWrappedInt64 = { -7408792260006172347L, }, RepeatedWrappedUint64 = { 11638824494023419247UL, }, RepeatedWrappedInt32 = { -1631926576, }, RepeatedWrappedUint32 = { 3960286655U, }, RepeatedWrappedBool = { true, }, RepeatedWrappedString = { "repeated_wrapped_string86f2fee9", }, RepeatedWrappedBytes = { proto::ByteString.CopyFromUtf8("repeated_wrapped_bytesaa9512b2"), }, RepeatedStruct = { new wkt::Struct(), }, }; Response expectedResponse = new Response { }; mockGrpcClient.Setup(x => x.MethodValues(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); UnitTestsClient client = new UnitTestsClientImpl(mockGrpcClient.Object, null); Response response = client.MethodValues(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }