public void Get() { moq::Mock <LicenseCodes.LicenseCodesClient> mockGrpcClient = new moq::Mock <LicenseCodes.LicenseCodesClient>(moq::MockBehavior.Strict); GetLicenseCodeRequest request = new GetLicenseCodeRequest { LicenseCode = "license_code196a50c0", Project = "projectaa6ff846", }; LicenseCode expectedResponse = new LicenseCode { Id = "id74b70bb8", Kind = "kindf7aa39d9", Name = "name1c9368b0", Transferable = false, CreationTimestamp = "creation_timestamp235e59a1", LicenseAlias = { new LicenseCodeLicenseAlias(), }, State = LicenseCode.Types.State.UndefinedState, Description = "description2cf9da67", SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LicenseCodesClient client = new LicenseCodesClientImpl(mockGrpcClient.Object, null); LicenseCode response = client.Get(request.Project, request.LicenseCode); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetRequestObjectAsync() { moq::Mock <LicenseCodes.LicenseCodesClient> mockGrpcClient = new moq::Mock <LicenseCodes.LicenseCodesClient>(moq::MockBehavior.Strict); GetLicenseCodeRequest request = new GetLicenseCodeRequest { LicenseCode = "license_code196a50c0", Project = "projectaa6ff846", }; LicenseCode expectedResponse = new LicenseCode { Id = "id74b70bb8", Kind = "kindf7aa39d9", Name = "name1c9368b0", Transferable = false, CreationTimestamp = "creation_timestamp235e59a1", LicenseAlias = { new LicenseCodeLicenseAlias(), }, State = LicenseCode.Types.State.UndefinedState, Description = "description2cf9da67", SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <LicenseCode>(stt::Task.FromResult(expectedResponse), null, null, null, null)); LicenseCodesClient client = new LicenseCodesClientImpl(mockGrpcClient.Object, null); LicenseCode responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); LicenseCode responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetLicenseCodeRequest, CallSettings) // Create client LicenseCodesClient licenseCodesClient = LicenseCodesClient.Create(); // Initialize request argument(s) GetLicenseCodeRequest request = new GetLicenseCodeRequest { LicenseCode = "", Project = "", }; // Make the request LicenseCode response = licenseCodesClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetLicenseCodeRequest, CallSettings) // Additional: GetAsync(GetLicenseCodeRequest, CancellationToken) // Create client LicenseCodesClient licenseCodesClient = await LicenseCodesClient.CreateAsync(); // Initialize request argument(s) GetLicenseCodeRequest request = new GetLicenseCodeRequest { LicenseCode = "", Project = "", }; // Make the request LicenseCode response = await licenseCodesClient.GetAsync(request); // End snippet }
/// <summary> /// Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. /// </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 <LicenseCode> GetAsync(GetLicenseCodeRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetLicenseCodeRequest(ref request, ref callSettings); return(_callGet.Async(request, callSettings)); }
/// <summary> /// Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. /// </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 LicenseCode Get(GetLicenseCodeRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetLicenseCodeRequest(ref request, ref callSettings); return(_callGet.Sync(request, callSettings)); }
partial void Modify_GetLicenseCodeRequest(ref GetLicenseCodeRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. /// </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 <LicenseCode> GetAsync(GetLicenseCodeRequest request, st::CancellationToken cancellationToken) => GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. /// </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 <LicenseCode> GetAsync(GetLicenseCodeRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. /// </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 virtual LicenseCode Get(GetLicenseCodeRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();