public void ModifyRequest()
        {
            var options = new ListJobsOptions
            {
                PageSize        = 25,
                StateFilter     = JobState.Pending,
                AllUsers        = true,
                Projection      = ProjectionEnum.Full,
                PageToken       = "nextpage",
                MinCreationTime = new DateTimeOffset(1970, 1, 1, 0, 0, 1, TimeSpan.Zero),
                // Negative offset means this UTC is ahead of local time - so this is 1970-01-01T00:01:01Z.
                MaxCreationTime = new DateTimeOffset(1970, 1, 1, 0, 0, 1, TimeSpan.FromMinutes(-1)),
                ParentJobId     = "dummy_parent_id"
            };
            ListRequest request = new ListRequest(new BigqueryService(), "project");

            options.ModifyRequest(request);
            Assert.Equal(25, request.MaxResults);
            Assert.Equal(StateFilterEnum.Pending, request.StateFilter);
            Assert.Equal(true, request.AllUsers);
            Assert.Equal(ProjectionEnum.Full, request.Projection);
            Assert.Equal("nextpage", request.PageToken);
            Assert.Equal(1000UL, request.MinCreationTime);
            Assert.Equal(61000UL, request.MaxCreationTime);
            Assert.Equal("dummy_parent_id", request.ParentJobId);
        }
Ejemplo n.º 2
0
        public void MaxCreationTimeBeforeUnixEpoch()
        {
            var options = new ListJobsOptions
            {
                MaxCreationTime = new DateTimeOffset(1969, 12, 31, 23, 59, 59, TimeSpan.Zero),
            };
            ListRequest request = new ListRequest(new BigqueryService(), "project");

            Assert.Throws <ArgumentOutOfRangeException>(() => options.ModifyRequest(request));
        }
Ejemplo n.º 3
0
        public void MinCreationTimeLaterThanMaxCreationTime()
        {
            var options = new ListJobsOptions
            {
                MinCreationTime = new DateTimeOffset(2001, 1, 1, 0, 0, 0, TimeSpan.Zero),
                MaxCreationTime = new DateTimeOffset(2000, 1, 1, 0, 0, 0, TimeSpan.Zero)
            };
            ListRequest request = new ListRequest(new BigqueryService(), "project");

            Assert.Throws <ArgumentException>(() => options.ModifyRequest(request));
        }
        public void ModifyRequest()
        {
            var options = new ListJobsOptions
            {
                PageSize    = 25,
                StateFilter = JobState.Pending
            };
            ListRequest request = new ListRequest(new BigqueryService(), "project");

            options.ModifyRequest(request);
            Assert.Equal(25, request.MaxResults);
            Assert.Equal(StateFilterEnum.Pending, request.StateFilter);
        }
Ejemplo n.º 5
0
        public void ModifyRequest_NoOp()
        {
            var         options = new ListJobsOptions();
            ListRequest request = new ListRequest(new BigqueryService(), "project");

            options.ModifyRequest(request);
            Assert.Null(request.MaxResults);
            Assert.Null(request.StateFilter);
            Assert.Null(request.AllUsers);
            Assert.Null(request.Projection);
            Assert.Null(request.PageToken);
            Assert.Null(request.MinCreationTime);
            Assert.Null(request.MaxCreationTime);
        }
Ejemplo n.º 6
0
        public void ModifyRequest()
        {
            var options = new ListJobsOptions
            {
                PageSize    = 25,
                StateFilter = JobState.Pending,
                AllUsers    = true,
                Projection  = ProjectionEnum.Full,
                PageToken   = "nextpage"
            };
            ListRequest request = new ListRequest(new BigqueryService(), "project");

            options.ModifyRequest(request);
            Assert.Equal(25, request.MaxResults);
            Assert.Equal(StateFilterEnum.Pending, request.StateFilter);
            Assert.Equal(true, request.AllUsers);
            Assert.Equal(ProjectionEnum.Full, request.Projection);
            Assert.Equal("nextpage", request.PageToken);
        }