コード例 #1
0
        private void AssertAreClose(DateTime expected, DateTime actual)
        {
            var diff = expected - actual;

            Assert.IsTrue(diff.TotalSeconds <= 1, HudsonBuildStatusTest.DateAsCode(actual));
        }
コード例 #2
0
        public void CruiseControlNetBuildStatus_InProgress()
        {
            var document = ResourceManager.CruiseControlNetJoesProject1;
            BuildDefinitionSetting buildDefinitionSetting = new BuildDefinitionSetting();

            buildDefinitionSetting.Name = "Name";
            buildDefinitionSetting.Id   = "BuildDefinitionId";
            XElement projectElement = document.Root.Element("Project");

            CruiseControlNetBuildStatus.ClearCache();
            CruiseControlNetBuildStatus buildStatus = new CruiseControlNetBuildStatus(projectElement, null);

            Assert.AreEqual(BuildStatusEnum.InProgress, buildStatus.BuildStatusEnum);
            Assert.AreEqual("CruiseControlNetProj1", buildStatus.BuildDefinitionId);
            Assert.AreEqual("CruiseControlNetProj1", buildStatus.Name);
            Assert.AreEqual(null, buildStatus.RequestedBy);
            Assert.IsNotNull(buildStatus.StartedTime);
            Assert.AreEqual(new DateTime(2011, 8, 28, 17, 20, 5, 375), buildStatus.StartedTime.Value.ToUniversalTime(), HudsonBuildStatusTest.DateAsCode(buildStatus.StartedTime.Value.ToUniversalTime()));
            Assert.IsNull(buildStatus.Comment);
            Assert.IsNotNull(buildStatus.FinishedTime);
            Assert.AreEqual(new DateTime(2011, 8, 28, 17, 20, 5, 375), buildStatus.FinishedTime.Value.ToUniversalTime(), HudsonBuildStatusTest.DateAsCode(buildStatus.FinishedTime.Value.ToUniversalTime()));
            //Assert.AreEqual("http://win7ci:8081/job/SvnTest/30/", buildStatus.Url);
            //Assert.AreEqual(30, buildStatus.BuildId);
        }
コード例 #3
0
        public void TeamCityFailureDueToCleanup()
        {
            var teamCityFailureDueToCleanup = TeamCityResources.TeamCityFailureDueToCleanup;
            BuildDefinitionSetting buildDefinitionSetting = new BuildDefinitionSetting
            {
                Name = "Name",
                Id   = "BuildDefinitionId"
            };
            var buildStatus = new TeamCityBuildStatus(buildDefinitionSetting, teamCityFailureDueToCleanup, null);

            Assert.AreEqual(BuildStatusEnum.Unknown, buildStatus.BuildStatusEnum);
            Assert.AreEqual("BuildDefinitionId", buildStatus.BuildDefinitionId);
            Assert.AreEqual("db_maintenance Database [GRAVIS1]", buildStatus.Name);
            Assert.AreEqual(null, buildStatus.RequestedBy);
            Assert.AreEqual(new DateTime(2012, 5, 29, 21, 0, 7, 0), buildStatus.StartedTime, HudsonBuildStatusTest.DateAsCode(buildStatus.StartedTime.Value));
            Assert.AreEqual(null, buildStatus.Comment);
            Assert.AreEqual(new DateTime(2012, 5, 29, 21, 0, 12, 0), buildStatus.FinishedTime, HudsonBuildStatusTest.DateAsCode(buildStatus.FinishedTime.Value)); // timestamp+duration
            Assert.AreEqual("http://teamcity.com/viewLog.html?buildId=32470&buildTypeId=bt231", buildStatus.Url);
            Assert.AreEqual("32470", buildStatus.BuildId);
        }
コード例 #4
0
        public void TeamCityBuildStatus_PassingBuildNoComment()
        {
            var teamCityFailingBuild  = TeamCityResources.TeamCityFailingBuild;
            var teamCityFailingChange = TeamCityResources.TeamCityFailingChange;
            BuildDefinitionSetting buildDefinitionSetting = new BuildDefinitionSetting
            {
                Name = "Name",
                Id   = "BuildDefinitionId"
            };
            var buildStatus = new TeamCityBuildStatus(buildDefinitionSetting, teamCityFailingBuild, teamCityFailingChange);

            Assert.AreEqual(BuildStatusEnum.Broken, buildStatus.BuildStatusEnum);
            Assert.AreEqual("BuildDefinitionId", buildStatus.BuildDefinitionId);
            Assert.AreEqual("BuildConfig4", buildStatus.Name);
            Assert.AreEqual("lee", buildStatus.RequestedBy);
            Assert.AreEqual(new DateTime(2012, 1, 27, 0, 15, 45, 0), buildStatus.StartedTime, HudsonBuildStatusTest.DateAsCode(buildStatus.StartedTime.Value));
            string expectedComment = @"Merge branch 'master' of C:\dev\CiTest

Conflicts:
	CiTest/Program.cs"    .Replace("\r", "");

            Assert.AreEqual(expectedComment.Replace("\r\n", "\r"), buildStatus.Comment);
            Assert.AreEqual(new DateTime(2012, 1, 27, 0, 16, 2, 0), buildStatus.FinishedTime, HudsonBuildStatusTest.DateAsCode(buildStatus.FinishedTime.Value)); // timestamp+duration
            Assert.AreEqual("http://win7ci:8080/viewLog.html?buildId=35&buildTypeId=bt2", buildStatus.Url);
            Assert.AreEqual("35", buildStatus.BuildId);
        }
コード例 #5
0
        public void TeamCityBuildStatus_Working_10_0_0_4()
        {
            var buildInfo  = TeamCityResources.TeamCity_10004_BuildInfo;
            var changeInfo = TeamCityResources.TeamCity_10004_changeInfo;
            BuildDefinitionSetting buildDefinitionSetting = new BuildDefinitionSetting
            {
                Name = "Name",
                Id   = "BuildDefinitionId"
            };
            var buildStatus = new TeamCityBuildStatus(buildDefinitionSetting, buildInfo, changeInfo);

            Assert.AreEqual(BuildStatusEnum.Working, buildStatus.BuildStatusEnum);
            Assert.AreEqual("BuildDefinitionId", buildStatus.BuildDefinitionId);
            Assert.AreEqual("Tests", buildStatus.Name);
            Assert.AreEqual("*****@*****.**", buildStatus.RequestedBy);
            Assert.AreEqual(new DateTime(2017, 1, 1, 12, 00, 00, 0), buildStatus.StartedTime, HudsonBuildStatusTest.DateAsCode(buildStatus.StartedTime.Value));
            string expectedComment = "someonebroke the build and I am very sad";

            Assert.AreEqual(expectedComment.Replace("\r\n", "\r"), buildStatus.Comment);
            Assert.AreEqual(new DateTime(2017, 1, 1, 12, 00, 00, 0), buildStatus.FinishedTime, HudsonBuildStatusTest.DateAsCode(buildStatus.FinishedTime.Value)); // timestamp+duration
            Assert.AreEqual("http://teamcity/viewLog.html?buildId=12345&buildTypeId=Test_Build_ID", buildStatus.Url);
            Assert.AreEqual("12345", buildStatus.BuildId);
        }
コード例 #6
0
        public void CruiseControlNetBuildStatus_TwoBackToBackNotStartedBuilds_StartedTimeShouldBeLastBuild()
        {
            var document = ResourceManager.CruiseControlNetJoesProject2;
            BuildDefinitionSetting buildDefinitionSetting = new BuildDefinitionSetting();

            buildDefinitionSetting.Name = "Name";
            buildDefinitionSetting.Id   = "BuildDefinitionId";
            XElement projectElement = document.Root.Element("Project");

            CruiseControlNetBuildStatus.ClearCache();
            new CruiseControlNetBuildStatus(projectElement);
            CruiseControlNetBuildStatus buildStatus = new CruiseControlNetBuildStatus(projectElement);

            Assert.AreEqual(BuildStatusEnum.Unknown, buildStatus.BuildStatusEnum);
            Assert.AreEqual("CruiseControlNetProj1", buildStatus.BuildDefinitionId);
            Assert.AreEqual("CruiseControlNetProj1", buildStatus.Name);
            Assert.AreEqual(null, buildStatus.RequestedBy);
            Assert.IsNotNull(buildStatus.StartedTime);
            Assert.AreEqual(new DateTime(2011, 8, 27, 17, 21, 27, 843).ToString(), buildStatus.StartedTime.Value.ToUniversalTime().ToString(), HudsonBuildStatusTest.DateAsCode(buildStatus.StartedTime.Value.ToUniversalTime()));
            Assert.IsNull(buildStatus.Comment);
            Assert.IsNotNull(buildStatus.FinishedTime);
            Assert.AreEqual(new DateTime(2011, 8, 27, 17, 21, 27, 843).ToString(), buildStatus.FinishedTime.Value.ToUniversalTime().ToString(), HudsonBuildStatusTest.DateAsCode(buildStatus.FinishedTime.Value.ToUniversalTime()));
            //Assert.AreEqual("http://win7ci:8081/job/SvnTest/30/", buildStatus.Url);
            //Assert.AreEqual(30, buildStatus.BuildId);
        }
コード例 #7
0
        public void BambooBuildStatus_FailedWithComment()
        {
            var bambooFailingBuild = ResourceManager.BambooFailingBuild;
            BuildDefinitionSetting buildDefinitionSetting = new BuildDefinitionSetting();

            buildDefinitionSetting.Name = "Name";
            buildDefinitionSetting.Id   = "BuildDefinitionId";
            var buildStatus = BambooBuildStatus.CreateBuildResult(bambooFailingBuild, buildDefinitionSetting, "http://win7ci:8085");

            Assert.AreEqual(BuildStatusEnum.Broken, buildStatus.BuildStatusEnum);
            Assert.AreEqual("BuildDefinitionId", buildStatus.BuildDefinitionId);
            Assert.AreEqual("Name", buildStatus.Name);
            Assert.AreEqual("Lee", buildStatus.RequestedBy);
            Assert.AreEqual(new DateTime(2012, 3, 4, 0, 4, 23, 98), buildStatus.StartedTime.Value.ToUniversalTime(), HudsonBuildStatusTest.DateAsCode(buildStatus.StartedTime.Value.ToUniversalTime()));
            Assert.AreEqual("breaking the build", buildStatus.Comment);
            Assert.AreEqual(new DateTime(2012, 3, 4, 0, 4, 27, 61), buildStatus.FinishedTime.Value.ToUniversalTime(), HudsonBuildStatusTest.DateAsCode(buildStatus.FinishedTime.Value.ToUniversalTime())); // timestamp+duration
            Assert.AreEqual("2", buildStatus.BuildId);
            Assert.AreEqual("http://win7ci:8085/browse/CITEST-CITESTPLANKEY-2", buildStatus.Url);
        }