public void CreateClientEvent()
        {
            Mock <EventService.EventServiceClient> mockGrpcClient = new Mock <EventService.EventServiceClient>(MockBehavior.Strict);
            CreateClientEventRequest expectedRequest = new CreateClientEventRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
                ClientEvent = new ClientEvent(),
            };
            ClientEvent expectedResponse = new ClientEvent
            {
                RequestId  = "requestId37109963",
                EventId    = "eventId278118624",
                EventNotes = "eventNotes445073628",
            };

            mockGrpcClient.Setup(x => x.CreateClientEvent(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            EventServiceClient       client = new EventServiceClientImpl(mockGrpcClient.Object, null);
            TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
            ClientEvent clientEvent         = new ClientEvent();
            ClientEvent response            = client.CreateClientEvent(parent, clientEvent);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void CreateClientEvent()
        {
            moq::Mock <EventService.EventServiceClient> mockGrpcClient = new moq::Mock <EventService.EventServiceClient>(moq::MockBehavior.Strict);
            CreateClientEventRequest request = new CreateClientEventRequest
            {
                ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                ClientEvent        = new ClientEvent(),
            };
            ClientEvent expectedResponse = new ClientEvent
            {
                RequestId    = "request_id362c8df6",
                EventId      = "event_idaccf3744",
                CreateTime   = new wkt::Timestamp(),
                JobEvent     = new JobEvent(),
                ProfileEvent = new ProfileEvent(),
                EventNotes   = "event_notes102ba330",
            };

            mockGrpcClient.Setup(x => x.CreateClientEvent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            EventServiceClient client   = new EventServiceClientImpl(mockGrpcClient.Object, null);
            ClientEvent        response = client.CreateClientEvent(request.Parent, request.ClientEvent);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        public void CreateClientEvent()
        {
            Mock <EventService.EventServiceClient> mockGrpcClient = new Mock <EventService.EventServiceClient>(MockBehavior.Strict);
            CreateClientEventRequest expectedRequest = new CreateClientEventRequest
            {
                Parent      = new ProjectName("[PROJECT]").ToString(),
                ClientEvent = new ClientEvent(),
            };
            ClientEvent expectedResponse = new ClientEvent
            {
                RequestId     = "requestId37109963",
                EventId       = "eventId278118624",
                ParentEventId = "parentEventId-436467499",
            };

            mockGrpcClient.Setup(x => x.CreateClientEvent(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            EventServiceClient client          = new EventServiceClientImpl(mockGrpcClient.Object, null);
            string             formattedParent = new ProjectName("[PROJECT]").ToString();
            ClientEvent        clientEvent     = new ClientEvent();
            ClientEvent        response        = client.CreateClientEvent(formattedParent, clientEvent);

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