Пример #1
0
        public async stt::Task GetSessionEntityTypeRequestObjectAsync()
        {
            moq::Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new moq::Mock <SessionEntityTypes.SessionEntityTypesClient>(moq::MockBehavior.Strict);
            GetSessionEntityTypeRequest request = new GetSessionEntityTypeRequest
            {
                SessionEntityTypeName = SessionEntityTypeName.FromProjectSessionEntityType("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };
            SessionEntityType expectedResponse = new SessionEntityType
            {
                SessionEntityTypeName = SessionEntityTypeName.FromProjectSessionEntityType("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
                EntityOverrideMode    = SessionEntityType.Types.EntityOverrideMode.Supplement,
                Entities =
                {
                    new EntityType.Types.Entity(),
                },
            };

            mockGrpcClient.Setup(x => x.GetSessionEntityTypeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SessionEntityType>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SessionEntityTypesClient client = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            SessionEntityType        responseCallSettings = await client.GetSessionEntityTypeAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            SessionEntityType responseCancellationToken = await client.GetSessionEntityTypeAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Пример #2
0
        public void CreateSessionEntityTypeRequestObject()
        {
            moq::Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new moq::Mock <SessionEntityTypes.SessionEntityTypesClient>(moq::MockBehavior.Strict);
            CreateSessionEntityTypeRequest request = new CreateSessionEntityTypeRequest
            {
                Parent            = "parent7858e4d0",
                SessionEntityType = new SessionEntityType(),
            };
            SessionEntityType expectedResponse = new SessionEntityType
            {
                SessionEntityTypeName = SessionEntityTypeName.FromProjectSessionEntityType("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
                EntityOverrideMode    = SessionEntityType.Types.EntityOverrideMode.Supplement,
                Entities =
                {
                    new EntityType.Types.Entity(),
                },
            };

            mockGrpcClient.Setup(x => x.CreateSessionEntityType(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SessionEntityTypesClient client   = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            SessionEntityType        response = client.CreateSessionEntityType(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #3
0
        public void UpdateSessionEntityType()
        {
            moq::Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new moq::Mock <SessionEntityTypes.SessionEntityTypesClient>(moq::MockBehavior.Strict);
            UpdateSessionEntityTypeRequest request = new UpdateSessionEntityTypeRequest
            {
                SessionEntityType = new SessionEntityType(),
                UpdateMask        = new wkt::FieldMask(),
            };
            SessionEntityType expectedResponse = new SessionEntityType
            {
                SessionEntityTypeName = SessionEntityTypeName.FromProjectLocationAgentSessionEntityType("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"),
                EntityOverrideMode    = SessionEntityType.Types.EntityOverrideMode.Supplement,
                Entities =
                {
                    new EntityType.Types.Entity(),
                },
            };

            mockGrpcClient.Setup(x => x.UpdateSessionEntityType(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SessionEntityTypesClient client   = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            SessionEntityType        response = client.UpdateSessionEntityType(request.SessionEntityType, request.UpdateMask);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #4
0
        public void DeleteSessionEntityTypeResourceNames()
        {
            moq::Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new moq::Mock <SessionEntityTypes.SessionEntityTypesClient>(moq::MockBehavior.Strict);
            DeleteSessionEntityTypeRequest request = new DeleteSessionEntityTypeRequest
            {
                ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

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

            client.DeleteSessionEntityType(request.ContextName);
            mockGrpcClient.VerifyAll();
        }
Пример #5
0
        public void DeleteSessionEntityType()
        {
            moq::Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new moq::Mock <SessionEntityTypes.SessionEntityTypesClient>(moq::MockBehavior.Strict);
            DeleteSessionEntityTypeRequest request = new DeleteSessionEntityTypeRequest
            {
                SessionEntityTypeName = SessionEntityTypeName.FromProjectLocationAgentSessionEntityType("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]", "[ENTITY_TYPE]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

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

            client.DeleteSessionEntityType(request.Name);
            mockGrpcClient.VerifyAll();
        }
        public async Task DeleteSessionEntityTypeAsync2()
        {
            Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new Mock <SessionEntityTypes.SessionEntityTypesClient>(MockBehavior.Strict);
            DeleteSessionEntityTypeRequest request = new DeleteSessionEntityTypeRequest
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSessionEntityTypeAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            SessionEntityTypesClient client = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            await client.DeleteSessionEntityTypeAsync(request);

            mockGrpcClient.VerifyAll();
        }
        public void DeleteSessionEntityType2()
        {
            Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new Mock <SessionEntityTypes.SessionEntityTypesClient>(MockBehavior.Strict);
            DeleteSessionEntityTypeRequest request = new DeleteSessionEntityTypeRequest
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSessionEntityType(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SessionEntityTypesClient client = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);

            client.DeleteSessionEntityType(request);
            mockGrpcClient.VerifyAll();
        }
Пример #8
0
        public async stt::Task DeleteSessionEntityTypeResourceNamesAsync()
        {
            moq::Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new moq::Mock <SessionEntityTypes.SessionEntityTypesClient>(moq::MockBehavior.Strict);
            DeleteSessionEntityTypeRequest request = new DeleteSessionEntityTypeRequest
            {
                ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteSessionEntityTypeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            SessionEntityTypesClient client = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            await client.DeleteSessionEntityTypeAsync(request.ContextName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteSessionEntityTypeAsync(request.ContextName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
        public void GetSessionEntityType2()
        {
            Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new Mock <SessionEntityTypes.SessionEntityTypesClient>(MockBehavior.Strict);
            GetSessionEntityTypeRequest request = new GetSessionEntityTypeRequest
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };
            SessionEntityType expectedResponse = new SessionEntityType
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };

            mockGrpcClient.Setup(x => x.GetSessionEntityType(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SessionEntityTypesClient client   = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            SessionEntityType        response = client.GetSessionEntityType(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetSessionEntityTypeAsync()
        {
            Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new Mock <SessionEntityTypes.SessionEntityTypesClient>(MockBehavior.Strict);
            GetSessionEntityTypeRequest expectedRequest = new GetSessionEntityTypeRequest
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };
            SessionEntityType expectedResponse = new SessionEntityType
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };

            mockGrpcClient.Setup(x => x.GetSessionEntityTypeAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <SessionEntityType>(Task.FromResult(expectedResponse), null, null, null, null));
            SessionEntityTypesClient client   = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            SessionEntityTypeName    name     = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]");
            SessionEntityType        response = await client.GetSessionEntityTypeAsync(name);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void CreateSessionEntityType()
        {
            Mock <SessionEntityTypes.SessionEntityTypesClient> mockGrpcClient = new Mock <SessionEntityTypes.SessionEntityTypesClient>(MockBehavior.Strict);
            CreateSessionEntityTypeRequest expectedRequest = new CreateSessionEntityTypeRequest
            {
                ParentAsSessionName = new SessionName("[PROJECT]", "[SESSION]"),
                SessionEntityType   = new SessionEntityType(),
            };
            SessionEntityType expectedResponse = new SessionEntityType
            {
                SessionEntityTypeName = new SessionEntityTypeName("[PROJECT]", "[SESSION]", "[ENTITY_TYPE]"),
            };

            mockGrpcClient.Setup(x => x.CreateSessionEntityType(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SessionEntityTypesClient client     = new SessionEntityTypesClientImpl(mockGrpcClient.Object, null);
            SessionName       parent            = new SessionName("[PROJECT]", "[SESSION]");
            SessionEntityType sessionEntityType = new SessionEntityType();
            SessionEntityType response          = client.CreateSessionEntityType(parent, sessionEntityType);

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