示例#1
0
        public void SetUp()
        {
            _projectListResponse = new HudsonProjectListResponse();
            _projectResponse     = new HudsonFreeStyleProjectResponse();
            _queueResponse       = new HudsonQueueResponse();
            _buildResponse       = new HudsonFreeStyleBuildResponse
            {
                BuiltOn         = "06/12/2001",
                Duration        = SampleBuildDuration,
                FullDisplayName = SampleBuildProjectName + " #" + SampleBuildNumber,
                Id         = "2011-12-06_11-47-18",
                IsBuilding = false,
                KeepLog    = false,
                Number     = SampleBuildNumber,
                Result     = "SUCCESS",
                Timestamp  = 1323172038606,
                URL        = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            _serviceUnderTest = new HudsonCIApiService(
                FakeFeedRepositoryFactory.ProjectListRepository(_projectListResponse),
                FakeFeedRepositoryFactory.ProjectRepository(_projectResponse),
                FakeFeedRepositoryFactory.QueueRepository(_queueResponse),
                FakeFeedRepositoryFactory.BuildRepository(_buildResponse)
                );
        }
        public void SetUp()
        {
            var fakedBuildResponse = new HudsonBuildResponse
            {
                Number = 241,
                Url    = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            var fakedLastBuildResponse = new HudsonLastBuildResponse
            {
                Number = 242,
                Url    = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            var fakedLastCompletedBuildResponse = new HudsonLastCompletedBuildResponse
            {
                Number = 243,
                Url    = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            var fakedLastFailedBuildResponse = new HudsonLastFailedBuildResponse
            {
                Number = 244,
                Url    = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            var fakedLastSuccessfulBuildResponse = new HudsonLastSuccessfulBuildResponse
            {
                Number = 245,
                Url    = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            var fakedLastUnsuccessfulBuildResponse = new HudsonLastUnsuccessfulBuildResponse
            {
                Number = 246,
                Url    = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            _projectListResponse = new HudsonProjectListResponse();
            _projectResponse     = new HudsonFreeStyleProjectResponse
            {
                DisplayName = SampleBuildProjectName,
                Name        = SampleBuildProjectName,
                Url         = TestApiUri + "/job/" + SampleBuildProjectName + "/",
                Buildable   = true,
                Builds      = new List <HudsonBuildResponse> {
                    fakedBuildResponse
                },
                FirstBuild = fakedBuildResponse,
                LastBuild  = new List <HudsonLastBuildResponse> {
                    fakedLastBuildResponse
                },
                LastCompletedBuild = new List <HudsonLastCompletedBuildResponse> {
                    fakedLastCompletedBuildResponse
                },
                LastFailedBuild = new List <HudsonLastFailedBuildResponse> {
                    fakedLastFailedBuildResponse
                },
                LastSuccessfulBuild = new List <HudsonLastSuccessfulBuildResponse> {
                    fakedLastSuccessfulBuildResponse
                },
                LastUnsuccessfulBuild = new List <HudsonLastUnsuccessfulBuildResponse> {
                    fakedLastUnsuccessfulBuildResponse
                }
            };
            _queueResponse = new HudsonQueueResponse
            {
                Items = new List <HudsonQueueItemResponse>
                {
                    new HudsonQueueItemResponse {
                        Id = 0, Task = new HudsonTaskResponse {
                            Name = SampleBuildProjectName, Color = "green", Url = TestApiUri + "/job/" + SampleBuildProjectName + "/"
                        }
                    },
                    new HudsonQueueItemResponse {
                        Id = 1, Task = new HudsonTaskResponse {
                            Name = SampleBuildProjectName, Color = "green", Url = TestApiUri + "/job/" + SampleBuildProjectName + "/"
                        }
                    },
                    new HudsonQueueItemResponse {
                        Id = 2, Task = new HudsonTaskResponse {
                            Name = SampleBuildProjectName, Color = "green", Url = TestApiUri + "/job/" + SampleBuildProjectName + "/"
                        }
                    }
                }
            };
            _buildResponse = new HudsonFreeStyleBuildResponse
            {
                BuiltOn         = "06/12/2001",
                Duration        = SampleBuildDuration,
                FullDisplayName = SampleBuildProjectName + " #" + SampleBuildNumber,
                Id         = "2011-12-06_11-47-18",
                IsBuilding = false,
                KeepLog    = false,
                Number     = SampleBuildNumber,
                Result     = "SUCCESS",
                Timestamp  = 1323172038606,
                URL        = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
            };

            _serviceUnderTest = new HudsonCIApiService(
                FakeFeedRepositoryFactory.ProjectListRepository(_projectListResponse),
                FakeFeedRepositoryFactory.ProjectRepository(_projectResponse),
                FakeFeedRepositoryFactory.QueueRepository(_queueResponse),
                FakeFeedRepositoryFactory.BuildRepository(_buildResponse)
                );
        }