Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 /// <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
 }
Exemplo n.º 4
0
        /// <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
        }
Exemplo n.º 5
0
 /// <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));
 }
Exemplo n.º 6
0
 /// <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));
 }
Exemplo n.º 7
0
 partial void Modify_GetLicenseCodeRequest(ref GetLicenseCodeRequest request, ref gaxgrpc::CallSettings settings);
Exemplo n.º 8
0
 /// <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));
Exemplo n.º 9
0
 /// <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();
Exemplo n.º 10
0
 /// <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();