public void GetProjectStatus_when_valid_last_completed_build_should_get_new_status_with_it()
        {
            ApiTestDependencies mocks = new ApiTestDependencies();
            var target = CreateTestTarget(mocks);

            ProjectStatusSampleData projectStatusSampleData =
                new ProjectStatusSampleData();

            projectStatusSampleData.InitializeFromFile(@".\TestData\ProjectStatusSampleData1.xml");
            projectStatusSampleData.SetLastBuildNumberTo(101);

            ProjectStatus currentStatus =
                new ProjectStatus()
                {
                    LastBuildLabel = "100"
                };

            var buildInformationSampleData =
                new BuildInformationSampleData();
            buildInformationSampleData.InitializeFromFile(@".\TestData\BuildInformationSampleData1.xml");
            buildInformationSampleData.SetBuildNumberTo(101);

            mocks.EnqueueThisDocumentAsNextResponse(buildInformationSampleData.Document);

            // Act
            var actual = target.GetProjectStatus(projectStatusSampleData.Document, currentStatus);

            // Assert
            actual.LastBuildLabel.Should().Be("101");
        }
        public void GetProjectStatus_when_last_successful_build_exists_and_is_the_same_as_last_completed_build_number_should_use_last_successful_build_number()
        {
            ApiTestDependencies mocks = new ApiTestDependencies();
            var target = CreateTestTarget(mocks);

            ProjectStatusSampleData projectStatusSampleData =
                new ProjectStatusSampleData();

            projectStatusSampleData.InitializeFromFile(@".\TestData\ProjectStatusSampleData2_LastSuccessfulBuild.xml");
            projectStatusSampleData.SetLastSuccessfulBuildNumberTo(65834);

            ProjectStatus currentStatus =
                new ProjectStatus()
                {
                    LastBuildLabel = "65833"
                };

            // Configure the first request to GetBuildInformation which will be for the lastCompletedBuild
            // to match the last successful build number
            var lastCompletedBuildInformationSampleData =
                new BuildInformationSampleData();
            lastCompletedBuildInformationSampleData.InitializeFromFile(@".\TestData\BuildInformationSampleData1.xml");
            lastCompletedBuildInformationSampleData.SetBuildNumberTo(65834);

            mocks.EnqueueThisDocumentAsNextResponse(lastCompletedBuildInformationSampleData.Document);

            // Act
            var actual = target.GetProjectStatus(projectStatusSampleData.Document, currentStatus);

            // Assert
            actual.LastSuccessfulBuildLabel.Should().Be("65834");
        }