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 static Project FromHudsonAPI(HudsonFreeStyleProjectResponse response, BuildJob lastbuild, BuildJob successfulbuild, BuildJob completedbuild, BuildJob currentbuild, IEnumerable<Project> upstreamProjects, IEnumerable<Project> downstreamProjects, ProjectBuildQueue queue)
        {
            var projectname = response.Name;

            var progress = 0;
            if (currentbuild.IsBuilding)
                progress = GetPercentageProgress(currentbuild.Timestamp, successfulbuild.Duration);

            var position = queue.Items.ToList().FindIndex(x => x.Name == projectname) + 1;

            return new Project(projectname, lastbuild, successfulbuild, completedbuild, currentbuild, progress, position, upstreamProjects, downstreamProjects);
        }
        public void SetUp()
        {
            var fakedBuildResponse = new HudsonBuildResponse
                                     	{
                                     		Number = 241,
                                     		Url = TestApiUri + "/job/" + SampleBuildProjectName + "/" + SampleBuildNumber + "/"
                                                                };

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

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

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

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

            var fakedLastUnsuccessfulBuildResponse = new HudsonLastUnsuccessfulBuildResponse
            {
                Number = 241,
                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();
            _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)
            );
        }