public void AllocateIds2()
        {
            Mock <Datastore.DatastoreClient> mockGrpcClient = new Mock <Datastore.DatastoreClient>(MockBehavior.Strict);
            AllocateIdsRequest request = new AllocateIdsRequest
            {
                ProjectId = "projectId-1969970175",
                Keys      = { },
            };
            AllocateIdsResponse expectedResponse = new AllocateIdsResponse();

            mockGrpcClient.Setup(x => x.AllocateIds(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            DatastoreClient     client   = new DatastoreClientImpl(mockGrpcClient.Object, null);
            AllocateIdsResponse response = client.AllocateIds(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public void AllocateIds()
        {
            moq::Mock <Datastore.DatastoreClient> mockGrpcClient = new moq::Mock <Datastore.DatastoreClient>(moq::MockBehavior.Strict);
            AllocateIdsRequest request = new AllocateIdsRequest
            {
                Keys      = { new Key(), },
                ProjectId = "project_id43ad98b0",
            };
            AllocateIdsResponse expectedResponse = new AllocateIdsResponse {
                Keys = { new Key(), },
            };

            mockGrpcClient.Setup(x => x.AllocateIds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            DatastoreClient     client   = new DatastoreClientImpl(mockGrpcClient.Object, null);
            AllocateIdsResponse response = client.AllocateIds(request.ProjectId, request.Keys);

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