public async stt::Task CreateOfflineProfileRequestObjectAsync() { moq::Mock <ProfilerService.ProfilerServiceClient> mockGrpcClient = new moq::Mock <ProfilerService.ProfilerServiceClient>(moq::MockBehavior.Strict); CreateOfflineProfileRequest request = new CreateOfflineProfileRequest { Parent = "parent7858e4d0", Profile = new Profile(), }; Profile expectedResponse = new Profile { Name = "name1c9368b0", ProfileType = ProfileType.Contention, Deployment = new Deployment(), Duration = new wkt::Duration(), ProfileBytes = proto::ByteString.CopyFromUtf8("profile_bytes12d9894a"), Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.CreateOfflineProfileAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Profile>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ProfilerServiceClient client = new ProfilerServiceClientImpl(mockGrpcClient.Object, null); Profile responseCallSettings = await client.CreateOfflineProfileAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Profile responseCancellationToken = await client.CreateOfflineProfileAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CreateOfflineProfileRequestObject() { moq::Mock <ProfilerService.ProfilerServiceClient> mockGrpcClient = new moq::Mock <ProfilerService.ProfilerServiceClient>(moq::MockBehavior.Strict); CreateOfflineProfileRequest request = new CreateOfflineProfileRequest { Parent = "parent7858e4d0", Profile = new Profile(), }; Profile expectedResponse = new Profile { Name = "name1c9368b0", ProfileType = ProfileType.Contention, Deployment = new Deployment(), Duration = new wkt::Duration(), ProfileBytes = proto::ByteString.CopyFromUtf8("profile_bytes12d9894a"), Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.CreateOfflineProfile(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ProfilerServiceClient client = new ProfilerServiceClientImpl(mockGrpcClient.Object, null); Profile response = client.CreateOfflineProfile(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for CreateOfflineProfile</summary> public void CreateOfflineProfileRequestObject() { // Snippet: CreateOfflineProfile(CreateOfflineProfileRequest, CallSettings) // Create client ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create(); // Initialize request argument(s) CreateOfflineProfileRequest request = new CreateOfflineProfileRequest { Parent = "", Profile = new Profile(), }; // Make the request Profile response = profilerServiceClient.CreateOfflineProfile(request); // End snippet }
/// <summary>Snippet for CreateOfflineProfileAsync</summary> public async Task CreateOfflineProfileRequestObjectAsync() { // Snippet: CreateOfflineProfileAsync(CreateOfflineProfileRequest, CallSettings) // Additional: CreateOfflineProfileAsync(CreateOfflineProfileRequest, CancellationToken) // Create client ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync(); // Initialize request argument(s) CreateOfflineProfileRequest request = new CreateOfflineProfileRequest { Parent = "", Profile = new Profile(), }; // Make the request Profile response = await profilerServiceClient.CreateOfflineProfileAsync(request); // End snippet }
/// <summary> /// CreateOfflineProfile creates a new profile resource in the offline mode. /// The client provides the profile to create along with the profile bytes, the /// server records it. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_CreateOfflineProfileRequest(ref request, ref callSettings); return(_callCreateOfflineProfile.Async(request, callSettings)); }
/// <summary> /// CreateOfflineProfile creates a new profile resource in the offline mode. /// The client provides the profile to create along with the profile bytes, the /// server records it. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override Profile CreateOfflineProfile(CreateOfflineProfileRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_CreateOfflineProfileRequest(ref request, ref callSettings); return(_callCreateOfflineProfile.Sync(request, callSettings)); }
partial void Modify_CreateOfflineProfileRequest(ref CreateOfflineProfileRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// CreateOfflineProfile creates a new profile resource in the offline mode. /// The client provides the profile to create along with the profile bytes, the /// server records it. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, st::CancellationToken cancellationToken) => CreateOfflineProfileAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// CreateOfflineProfile creates a new profile resource in the offline mode. /// The client provides the profile to create along with the profile bytes, the /// server records it. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <Profile> CreateOfflineProfileAsync(CreateOfflineProfileRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();