当前位置: 首页>>代码示例>>C#>>正文


C# IntegrationResult.Clone方法代码示例

本文整理汇总了C#中ThoughtWorks.CruiseControl.Core.IntegrationResult.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# IntegrationResult.Clone方法的具体用法?C# IntegrationResult.Clone怎么用?C# IntegrationResult.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ThoughtWorks.CruiseControl.Core.IntegrationResult的用法示例。


在下文中一共展示了IntegrationResult.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CloneShouldWork

        public void CloneShouldWork()
        {
            string workingDir = Path.GetFullPath(Path.Combine(".", "workingdir"));
            string artifactDir = Path.GetFullPath(Path.Combine(".", "artifacts"));

            result = new IntegrationResult("project", workingDir, artifactDir,
                                           new IntegrationRequest(BuildCondition.IfModificationExists, "myTrigger", "John Doe"),
                                           new IntegrationSummary(IntegrationStatus.Failure, "label23", "label22",
                                                                  new DateTime(2005, 06, 06, 08, 45, 00)));
            result.StartTime = new DateTime(2005, 06, 06, 08, 45, 00);
            result.ProjectUrl = "http://localhost/ccnet2";
            result.BuildId = new Guid(IntegrationResultMother.DefaultBuildId);

            result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult()));
            result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()));

            Modification mods = new Modification();
            mods.UserName = "John";
            result.Modifications = new Modification[] { mods };


            var TheClone = result.Clone();


            Assert.AreEqual(result.IntegrationProperties.Count, TheClone.IntegrationProperties.Count);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetProject], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetProject]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetProjectUrl], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetProjectUrl]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetLabel], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetLabel]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetNumericLabel], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetNumericLabel]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetArtifactDirectory], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetArtifactDirectory]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetWorkingDirectory], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetWorkingDirectory]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetBuildCondition], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildCondition]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetIntegrationStatus], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetIntegrationStatus]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetLastIntegrationStatus], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetLastIntegrationStatus]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetRequestSource], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetRequestSource]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetUser], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetUser]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetListenerFile], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetListenerFile]);
            
            ArrayList failureUsers = TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetFailureUsers] as ArrayList;
            Assert.IsNotNull(failureUsers);
            ArrayList failureTasks = TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetFailureTasks] as ArrayList;
            Assert.IsNotNull(failureTasks);
            ArrayList Modifiers = TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetModifyingUsers] as ArrayList;
            Assert.IsNotNull(Modifiers);
            Assert.AreEqual(1, Modifiers.Count);
            Assert.AreEqual("John", Modifiers[0]);
            
            Assert.AreEqual(result.Status, TheClone.Status);
            
            //below are the ones that are not cloned, should these be cloned also, see bug 240
            //http://www.cruisecontrolnet.org/issues/240

            // We purposefully use culture-independent string formats
            //Assert.AreEqual("2005-06-06", TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildDate]);
            //Assert.AreEqual(IntegrationResultMother.DefaultBuildId, TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildId]);
            //Assert.AreEqual("08:45:00", TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildTime]);
            //Assert.AreEqual(1, failureUsers.Count);
            //Assert.AreEqual("user", failureUsers[0]);
            //Assert.AreEqual(1, failureTasks.Count);
            //Assert.AreEqual("task", failureTasks[0]);

        
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:63,代码来源:IntegrationResultTest.cs


注:本文中的ThoughtWorks.CruiseControl.Core.IntegrationResult.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。