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