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 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(); }