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


C# Server.Validate方法代码示例

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


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

示例1: ValidateValidatesChildren

 public void ValidateValidatesChildren()
 {
     var validated = false;
     var project = new ProjectStub
                       {
                           Name = "Project",
                           OnValidate = vl => validated = true
                       };
     var server = new Server("Server", project);
     var validationStub = new ValidationLogStub();
     server.Validate(validationStub);
     Assert.IsTrue(validated);
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:13,代码来源:ServerTests.cs

示例2: ValidateValidatesName

 public void ValidateValidatesName()
 {
     var validated = false;
     var server = new Server();
     var validationStub = new ValidationLogStub
                              {
                                  OnAddErrorMessage = (m, a) =>
                                                          {
                                                              Assert.AreEqual("The Server has no name specified.", m);
                                                              Assert.AreEqual(0, a.Length);
                                                              validated = true;
                                                          }
                              };
     server.Validate(validationStub);
     Assert.IsTrue(validated);
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:16,代码来源:ServerTests.cs

示例3: ValidateDetectsDuplicateChildItems

 public void ValidateDetectsDuplicateChildItems()
 {
     var errorAdded = false;
     var queue1 = new Queue("Queue");
     var queue2 = new Queue("Queue");
     var queue3 = new Queue("OtherQueue");
     var server = new Server("Server", queue1, queue2, queue3);
     var validationStub = new ValidationLogStub
                              {
                                  OnAddErrorMessage = (m, a) =>
                                                          {
                                                              Assert.AreEqual(
                                                                  "Duplicate {1} name detected: '{0}'", m);
                                                              CollectionAssert.AreEqual(
                                                                  new[] { "Queue", "child" },
                                                                  a);
                                                              errorAdded = true;
                                                          }
                              };
     server.Validate(validationStub);
     Assert.IsTrue(errorAdded);
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:22,代码来源:ServerTests.cs

示例4: ValidateDetectsDuplicateProjects

 public void ValidateDetectsDuplicateProjects()
 {
     var errorAdded = false;
     var project1 = new Project("Project");
     var project2 = new Project("Project");
     var childQueue = new Queue("Test", project2);
     var project3 = new Project("OtherProject");
     var server = new Server("Server", project1, childQueue, project3);
     var validationStub = new ValidationLogStub
                              {
                                  OnAddErrorMessage = (m, a) =>
                                                          {
                                                              Assert.AreEqual(
                                                                  "Duplicate {1} name detected: '{0}'", m);
                                                              CollectionAssert.AreEqual(
                                                                  new[] { "Project", "project" },
                                                                  a);
                                                              errorAdded = true;
                                                          }
                              };
     server.Validate(validationStub);
     Assert.IsTrue(errorAdded);
 }
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:23,代码来源:ServerTests.cs


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