예제 #1
0
        public void WhenCallingBuilds()
        {
            _buildOutcomes        = new BuildOutcomeCollection();
            _mockJenkinsRssParser = new Mock <IRssParser>();
            _mockJenkinsRssParser.Setup(parser => parser.LoadBuilds()).Returns(_buildOutcomes);

            _result = new HomeController(_mockJenkinsRssParser.Object).Builds();
        }
        public void GivenAtLeastOneBuildInProgressAndNoFailingOrUnknownBuildsThenOverallStatusIsBuilding()
        {
            var buildOutcomeCollection = new BuildOutcomeCollection
            {
                new BuildOutcome("successful build", 5, Status.Success()),
                new BuildOutcome("build in progress", 5, Status.Building()),
                new BuildOutcome("another successful build", 5, Status.Success())
            };

            Assert.That(buildOutcomeCollection.OverallStatus(), Is.EqualTo(Status.Building()));
        }
        public void GivenAllSuccessfulBuildsThenOverallStatusIsSuccess()
        {
            var buildOutcomeCollection = new BuildOutcomeCollection
            {
                new BuildOutcome("successful build", 5, Status.Success()),
                new BuildOutcome("another successful build", 5, Status.Success()),
                new BuildOutcome("yet another successful build", 5, Status.Success())
            };

            Assert.That(buildOutcomeCollection.OverallStatus(), Is.EqualTo(Status.Success()));
        }
        public void GivenAtLeastOneFailingBuildThenOverallStatusIsFailed()
        {
            var buildOutcomeCollection = new BuildOutcomeCollection
            {
                new BuildOutcome("successful build", 5, Status.Success()),
                new BuildOutcome("failed build", 5, Status.Fail()),
                new BuildOutcome("another successful build", 5, Status.Success()),
                new BuildOutcome("unknown build", 5, Status.Unknown()),
                new BuildOutcome("build in progress", 5, Status.Building())
            };

            Assert.That(buildOutcomeCollection.OverallStatus(), Is.EqualTo(Status.Fail()));
        }