public void GetProjectStatus_should_have_correct_webUrl() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); mocks.EnqueueThisFileAsNextResponse(@".\TestData\ProjectStatusSampleData1.xml"); mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildInformationSampleData1.xml"); // Act ProjectStatus status = target.GetProjectStatus(ProjectUrl, null); // Assert status.WebURL.Should().Be("https://builds.apache.org/job/Hadoop-1-win/"); }
public void GetProjectStatus_should_have_correct_project_name() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); mocks.EnqueueThisFileAsNextResponse(@".\TestData\ProjectStatusSampleData1.xml"); mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildInformationSampleData1.xml"); // Act var status = target.GetProjectStatus(ProjectUrl, null); // Assert status.Name.Should().Be(ProjectName); }
public void GetProjectStatus_when_build_number_has_changed_should_return_new_status() { 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" }; mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildInformationSampleData1.xml"); // Act ProjectStatus status = target.GetProjectStatus(projectStatusSampleData.Document, currentStatus); // Assert status.Should().NotBeSameAs(currentStatus); }
public void GetAllJobs_should_return_correct_number() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); mocks.EnqueueThisFileAsNextResponse(@".\TestData\TestJobsSampleData1.xml"); // Act var jobs = target.GetAllJobs(); // Assert jobs.Count.Should().Be(1076); CollectionAssert.AllItemsAreUnique(jobs); }
public void GetBuildParameters_should_return_correct_name_of_parameters() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildParametersSampleData1.xml"); // TODO add a response for the build information // Act var status = target.GetBuildParameters(ProjectUrl); // Assert status[0].Name.Should().Be("VERSION"); }
public void GetBuildInformation_should_have_correct_webUrl() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildInformationSampleData1.xml"); // TODO add a response for the build information // Act JenkinsBuildInformation status = target.GetBuildInformation(ProjectUrl); // Assert status.FullDisplayName.Should().Be("Hadoop-1-win #119"); }
public void GetProjectStatus_when_current_status_is_null_should_return_new_status() { ApiTestDependencies mocks = new ApiTestDependencies(); var target = CreateTestTarget(mocks); ProjectStatusSampleData projectStatusSampleData = new ProjectStatusSampleData(); projectStatusSampleData.InitializeFromFile(@".\TestData\ProjectStatusSampleData1.xml"); projectStatusSampleData.SetLastBuildNumberTo(101); mocks.EnqueueThisFileAsNextResponse(@".\TestData\BuildInformationSampleData1.xml"); // Act ProjectStatus status = target.GetProjectStatus(projectStatusSampleData.Document, null); // Assert status.Should().NotBeNull(); }