public void DeleteAgent()
        {
            Mock <Agents.AgentsClient> mockGrpcClient = new Mock <Agents.AgentsClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            DeleteAgentRequest request = new DeleteAgentRequest();
            Empty expectedResponse     = new Empty();

            mockGrpcClient.Setup(x => x.DeleteAgent(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AgentsClient client = new AgentsClientImpl(mockGrpcClient.Object, null);

            client.DeleteAgent(request);
            mockGrpcClient.VerifyAll();
        }
예제 #2
0
        public void DeleteAgentResourceNames()
        {
            moq::Mock <Agents.AgentsClient> mockGrpcClient = new moq::Mock <Agents.AgentsClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            DeleteAgentRequest request = new DeleteAgentRequest
            {
                ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteAgent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AgentsClient client = new AgentsClientImpl(mockGrpcClient.Object, null);

            client.DeleteAgent(request.ParentAsProjectName);
            mockGrpcClient.VerifyAll();
        }