Пример #1
0
        public void UpdateJob()
        {
            Mock <CloudScheduler.CloudSchedulerClient> mockGrpcClient = new Mock <CloudScheduler.CloudSchedulerClient>(MockBehavior.Strict);
            UpdateJobRequest expectedRequest = new UpdateJobRequest
            {
                Job        = new Job(),
                UpdateMask = new FieldMask(),
            };
            Job expectedResponse = new Job
            {
                Name        = "name3373707",
                Description = "description-1724546052",
                Schedule    = "schedule-697920873",
                TimeZone    = "timeZone36848094",
            };

            mockGrpcClient.Setup(x => x.UpdateJob(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CloudSchedulerClient client = new CloudSchedulerClientImpl(mockGrpcClient.Object, null);
            Job       job        = new Job();
            FieldMask updateMask = new FieldMask();
            Job       response   = client.UpdateJob(job, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #2
0
        public void UpdateJob2()
        {
            Mock <CloudScheduler.CloudSchedulerClient> mockGrpcClient = new Mock <CloudScheduler.CloudSchedulerClient>(MockBehavior.Strict);
            UpdateJobRequest request = new UpdateJobRequest
            {
                Job = new Job(),
            };
            Job expectedResponse = new Job
            {
                JobName     = new JobName("[PROJECT]", "[LOCATION]", "[JOB]"),
                Description = "description-1724546052",
                Schedule    = "schedule-697920873",
                TimeZone    = "timeZone36848094",
            };

            mockGrpcClient.Setup(x => x.UpdateJob(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CloudSchedulerClient client = new CloudSchedulerClientImpl(mockGrpcClient.Object, null);
            Job response = client.UpdateJob(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }