/// <summary>Snippet for Get</summary> public void Get() { // Snippet: Get(string, string, string, CallSettings) // Create client ImageFamilyViewsClient imageFamilyViewsClient = ImageFamilyViewsClient.Create(); // Initialize request argument(s) string project = ""; string zone = ""; string family = ""; // Make the request ImageFamilyView response = imageFamilyViewsClient.Get(project, zone, family); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetAsync() { // Snippet: GetAsync(string, string, string, CallSettings) // Additional: GetAsync(string, string, string, CancellationToken) // Create client ImageFamilyViewsClient imageFamilyViewsClient = await ImageFamilyViewsClient.CreateAsync(); // Initialize request argument(s) string project = ""; string zone = ""; string family = ""; // Make the request ImageFamilyView response = await imageFamilyViewsClient.GetAsync(project, zone, family); // End snippet }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetImageFamilyViewRequest, CallSettings) // Create client ImageFamilyViewsClient imageFamilyViewsClient = ImageFamilyViewsClient.Create(); // Initialize request argument(s) GetImageFamilyViewRequest request = new GetImageFamilyViewRequest { Zone = "", Project = "", Family = "", }; // Make the request ImageFamilyView response = imageFamilyViewsClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetImageFamilyViewRequest, CallSettings) // Additional: GetAsync(GetImageFamilyViewRequest, CancellationToken) // Create client ImageFamilyViewsClient imageFamilyViewsClient = await ImageFamilyViewsClient.CreateAsync(); // Initialize request argument(s) GetImageFamilyViewRequest request = new GetImageFamilyViewRequest { Zone = "", Project = "", Family = "", }; // Make the request ImageFamilyView response = await imageFamilyViewsClient.GetAsync(request); // End snippet }
public void Get() { moq::Mock <ImageFamilyViews.ImageFamilyViewsClient> mockGrpcClient = new moq::Mock <ImageFamilyViews.ImageFamilyViewsClient>(moq::MockBehavior.Strict); GetImageFamilyViewRequest request = new GetImageFamilyViewRequest { Zone = "zone255f4ea8", Project = "projectaa6ff846", Family = "family0bda3f0d", }; ImageFamilyView expectedResponse = new ImageFamilyView { Image = new Image(), }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ImageFamilyViewsClient client = new ImageFamilyViewsClientImpl(mockGrpcClient.Object, null); ImageFamilyView response = client.Get(request.Project, request.Zone, request.Family); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAsync() { moq::Mock <ImageFamilyViews.ImageFamilyViewsClient> mockGrpcClient = new moq::Mock <ImageFamilyViews.ImageFamilyViewsClient>(moq::MockBehavior.Strict); GetImageFamilyViewRequest request = new GetImageFamilyViewRequest { Zone = "zone255f4ea8", Project = "projectaa6ff846", Family = "family0bda3f0d", }; ImageFamilyView expectedResponse = new ImageFamilyView { Image = new Image(), }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ImageFamilyView>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ImageFamilyViewsClient client = new ImageFamilyViewsClientImpl(mockGrpcClient.Object, null); ImageFamilyView responseCallSettings = await client.GetAsync(request.Project, request.Zone, request.Family, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ImageFamilyView responseCancellationToken = await client.GetAsync(request.Project, request.Zone, request.Family, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }