public async stt::Task GetGeoTargetConstantRequestObjectAsync() { moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(moq::MockBehavior.Strict); GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest { ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), }; gagvr::GeoTargetConstant expectedResponse = new gagvr::GeoTargetConstant { ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), Status = gagve::GeoTargetConstantStatusEnum.Types.GeoTargetConstantStatus.Enabled, ParentGeoTargetAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), Id = -6774108720365892680L, GeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), CountryCode = "country_code8debec55", TargetType = "target_type1235462e", CanonicalName = "canonical_name5e3d81e6", }; mockGrpcClient.Setup(x => x.GetGeoTargetConstantAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::GeoTargetConstant>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); gagvr::GeoTargetConstant responseCallSettings = await client.GetGeoTargetConstantAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::GeoTargetConstant responseCancellationToken = await client.GetGeoTargetConstantAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetGeoTargetConstant() { moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(moq::MockBehavior.Strict); GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest { ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), }; gagvr::GeoTargetConstant expectedResponse = new gagvr::GeoTargetConstant { ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), Status = gagve::GeoTargetConstantStatusEnum.Types.GeoTargetConstantStatus.Enabled, ParentGeoTargetAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), Id = -6774108720365892680L, GeoTargetConstantName = gagvr::GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"), CountryCode = "country_code8debec55", TargetType = "target_type1235462e", CanonicalName = "canonical_name5e3d81e6", }; mockGrpcClient.Setup(x => x.GetGeoTargetConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); gagvr::GeoTargetConstant response = client.GetGeoTargetConstant(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void SuggestGeoTargetConstantsRequestObject() { moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(moq::MockBehavior.Strict); SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest { LocationNames = new SuggestGeoTargetConstantsRequest.Types.LocationNames(), GeoTargets = new SuggestGeoTargetConstantsRequest.Types.GeoTargets(), Locale = "locale9e6d21fb", CountryCode = "country_code8debec55", }; SuggestGeoTargetConstantsResponse expectedResponse = new SuggestGeoTargetConstantsResponse { GeoTargetConstantSuggestions = { new GeoTargetConstantSuggestion(), }, }; mockGrpcClient.Setup(x => x.SuggestGeoTargetConstants(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); SuggestGeoTargetConstantsResponse response = client.SuggestGeoTargetConstants(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task SuggestGeoTargetConstantsRequestObjectAsync() { moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(moq::MockBehavior.Strict); SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest { LocationNames = new SuggestGeoTargetConstantsRequest.Types.LocationNames(), GeoTargets = new SuggestGeoTargetConstantsRequest.Types.GeoTargets(), Locale = "locale9e6d21fb", CountryCode = "country_code8debec55", }; SuggestGeoTargetConstantsResponse expectedResponse = new SuggestGeoTargetConstantsResponse { GeoTargetConstantSuggestions = { new GeoTargetConstantSuggestion(), }, }; mockGrpcClient.Setup(x => x.SuggestGeoTargetConstantsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SuggestGeoTargetConstantsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); SuggestGeoTargetConstantsResponse responseCallSettings = await client.SuggestGeoTargetConstantsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); SuggestGeoTargetConstantsResponse responseCancellationToken = await client.SuggestGeoTargetConstantsAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task SuggestGeoTargetConstantsAsync2() { Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict); SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest { Locale = null, CountryCode = null, }; SuggestGeoTargetConstantsResponse expectedResponse = new SuggestGeoTargetConstantsResponse(); mockGrpcClient.Setup(x => x.SuggestGeoTargetConstantsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <SuggestGeoTargetConstantsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); SuggestGeoTargetConstantsResponse response = await client.SuggestGeoTargetConstantsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void SuggestGeoTargetConstants2() { Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict); SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest { Locale = null, CountryCode = null, }; SuggestGeoTargetConstantsResponse expectedResponse = new SuggestGeoTargetConstantsResponse(); mockGrpcClient.Setup(x => x.SuggestGeoTargetConstants(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); SuggestGeoTargetConstantsResponse response = client.SuggestGeoTargetConstants(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetGeoTargetConstant2() { Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict); GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest { ResourceName = new GeoTargetConstantName("[GEO_TARGET_CONSTANT]").ToString(), }; GeoTargetConstant expectedResponse = new GeoTargetConstant { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetGeoTargetConstant(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); GeoTargetConstant response = client.GetGeoTargetConstant(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetGeoTargetConstantAsync2() { Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict); GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest { ResourceName = new GeoTargetConstantName("[GEO_TARGET_CONSTANT]").ToString(), }; GeoTargetConstant expectedResponse = new GeoTargetConstant { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetGeoTargetConstantAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <GeoTargetConstant>(Task.FromResult(expectedResponse), null, null, null, null)); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); GeoTargetConstant response = await client.GetGeoTargetConstantAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task SuggestGeoTargetConstantsAsync() { Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict); SuggestGeoTargetConstantsRequest expectedRequest = new SuggestGeoTargetConstantsRequest { Locale = new StringValue().Value, // TODO(liseno): Implicit type cast from StringValue to String failed, CountryCode = new StringValue().Value, // TODO(liseno): Implicit type cast from StringValue to String failed, }; SuggestGeoTargetConstantsResponse expectedResponse = new SuggestGeoTargetConstantsResponse(); mockGrpcClient.Setup(x => x.SuggestGeoTargetConstantsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <SuggestGeoTargetConstantsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null); StringValue locale = new StringValue(); StringValue countryCode = new StringValue(); SuggestGeoTargetConstantsResponse response = await client.SuggestGeoTargetConstantsAsync(locale, countryCode); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }