Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 public void ValidateReturnsWarningIfNoName()
 {
     var warningAdded = false;
     var channel = new Wcf();
     var validator = new ValidationLogStub
                         {
                             OnAddWarningMessage = (m, a) =>
                                                       {
                                                           Assert.AreEqual("Channel does not have a name", m);
                                                           CollectionAssert.IsEmpty(a);
                                                           warningAdded = true;
                                                       }
                         };
     channel.Validate(validator);
     Assert.IsTrue(warningAdded);
 }
Esempio n. 4
0
 public void ValidateDetectsMissingPeriod()
 {
     var errorAdded = false;
     var trigger = new RollUp();
     var validation = new ValidationLogStub
                          {
                              OnAddErrorMessage = (m, a) =>
                                                      {
                                                          Assert.AreEqual(
                                                              "No period set - trigger will not fire",
                                                              m);
                                                          CollectionAssert.IsEmpty(a);
                                                          errorAdded = true;
                                                      }
                          };
     trigger.Validate(validation);
     Assert.IsTrue(errorAdded);
 }
Esempio n. 5
0
 public void ValidateDetectsDuplicateChildItems()
 {
     var errorAdded = false;
     var project1 = new Project("Project");
     var project2 = new Project("Project");
     var project3 = new Project("OtherProject");
     var queue = new Queue("QueueName", project1, project2, project3);
     var validationStub = new ValidationLogStub
                              {
                                  OnAddErrorMessage = (m, a) =>
                                                          {
                                                              Assert.AreEqual(
                                                                  "Duplicate {1} name detected: '{0}'", m);
                                                              CollectionAssert.AreEqual(
                                                                  new[] { "Project", "child" },
                                                                  a);
                                                              errorAdded = true;
                                                          }
                              };
     queue.Validate(validationStub);
     Assert.IsTrue(errorAdded);
 }
Esempio n. 6
0
 public void ProjectNameIsCheckedInValidation()
 {
     var project = new Project();
     var verified = false;
     var validationStub = new ValidationLogStub
                              {
                                  OnAddErrorMessage = (m, a) =>
                                                          {
                                                              Assert.AreEqual("The {0} has no name specified.", m);
                                                              Assert.AreEqual("Project", a[0]);
                                                              verified = true;
                                                          }
                              };
     project.Validate(validationStub);
     Assert.IsTrue(verified);
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 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);
 }