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); }
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)); }
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); }
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); }
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); }