InitializeFromFile() public method

public InitializeFromFile ( string testdataProjectstatussampledata1Xml ) : void
testdataProjectstatussampledata1Xml string
return void
        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_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();
        }
        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");
        }
        public void GetProjectStatus_when_build_number_has_not_changed_should_return_current_status()
        {
            ApiTestDependencies mocks = new ApiTestDependencies();
            var target = CreateTestTarget(mocks);

            ProjectStatusSampleData projectStatusSampleData =
                new ProjectStatusSampleData();

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

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

            // Act
            ProjectStatus status = target.GetProjectStatus(projectStatusSampleData.Document, currentStatus);

            // Assert
            status.Should().BeSameAs(currentStatus);
        }