public async stt::Task UpdateRequestObjectAsync() { moq::Mock <Autoscalers.AutoscalersClient> mockGrpcClient = new moq::Mock <Autoscalers.AutoscalersClient>(moq::MockBehavior.Strict); UpdateAutoscalerRequest request = new UpdateAutoscalerRequest { Zone = "zone255f4ea8", RequestId = "request_id362c8df6", AutoscalerResource = new Autoscaler(), Project = "projectaa6ff846", Autoscaler = "autoscaleradfcda44", }; Operation expectedResponse = new Operation { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", User = "******", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", StartTime = "start_timebd8dd9c4", OperationGroupId = "operation_group_idd2040cf0", TargetLink = "target_link9b435dc0", Progress = 278622268, Error = new Error(), EndTime = "end_time89285d30", Region = "regionedb20d96", OperationType = "operation_typeece9e153", Status = Operation.Types.Status.Pending, HttpErrorMessage = "http_error_messageb5ef3c7f", TargetId = 6263187990225347157UL, ClientOperationId = "client_operation_id4e51b631", StatusMessage = "status_message2c618f86", HttpErrorStatusCode = 1766362655, Description = "description2cf9da67", InsertTime = "insert_time7467185a", SelfLink = "self_link7e87f12d", Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.UpdateAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AutoscalersClient client = new AutoscalersClientImpl(mockGrpcClient.Object, null); Operation responseCallSettings = await client.UpdateAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Operation responseCancellationToken = await client.UpdateAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task GetRequestObjectAsync() { moq::Mock <Autoscalers.AutoscalersClient> mockGrpcClient = new moq::Mock <Autoscalers.AutoscalersClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForZoneOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetAutoscalerRequest request = new GetAutoscalerRequest { Zone = "zone255f4ea8", Project = "projectaa6ff846", Autoscaler = "autoscaleradfcda44", }; Autoscaler expectedResponse = new Autoscaler { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", Status = Autoscaler.Types.Status.Pending, Target = "targetaefbae42", AutoscalingPolicy = new AutoscalingPolicy(), RecommendedSize = 213286470, StatusDetails = { new AutoscalerStatusDetails(), }, Description = "description2cf9da67", SelfLink = "self_link7e87f12d", ScalingScheduleStatus = { { "key8a0b6e3c", new ScalingScheduleStatus() }, }, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Autoscaler>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AutoscalersClient client = new AutoscalersClientImpl(mockGrpcClient.Object, null); Autoscaler responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Autoscaler responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetRequestObject() { moq::Mock <Autoscalers.AutoscalersClient> mockGrpcClient = new moq::Mock <Autoscalers.AutoscalersClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForZoneOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetAutoscalerRequest request = new GetAutoscalerRequest { Zone = "zone255f4ea8", Project = "projectaa6ff846", Autoscaler = "autoscaleradfcda44", }; Autoscaler expectedResponse = new Autoscaler { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", Status = "status5444cb9a", Target = "targetaefbae42", AutoscalingPolicy = new AutoscalingPolicy(), RecommendedSize = 213286470, StatusDetails = { new AutoscalerStatusDetails(), }, Description = "description2cf9da67", SelfLink = "self_link7e87f12d", ScalingScheduleStatus = { { "key8a0b6e3c", new ScalingScheduleStatus() }, }, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AutoscalersClient client = new AutoscalersClientImpl(mockGrpcClient.Object, null); Autoscaler response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }