public void Validation_Success()
        {
            Baptizer baptizer = TestFactories.GetBaptizer();
            bool     result   = baptizer.IsValid;

            Assert.IsTrue(result);
            Assert.AreEqual(baptizer.Errors.Count, 0);
        }
 public FakeBaptizerRepository()
 {
     if (baptizers.Count == 0)
     {
         for (int i = 0; i < 3; i++)
         {
             Baptizer baptizer = TestFactories.GetBaptizer();
             baptizer.BaptizerID = i + 1;
             baptizers.Add(baptizer);
             count++;
         }
     }
 }
Ejemplo n.º 3
0
        public void Schedule_Item_Baptizer_Sync()
        {
            ScheduleController controller = new ScheduleController();
            Schedule           schedule   = CreateSchedule();

            Baptizer b1 = new Baptizer
            {
                Person = new Person {
                    PersonID = 3, FirstName = "Jimmy", LastName = "Jams"
                }
            };

            Baptizer b2 = new Baptizer
            {
                Person = new Person {
                    PersonID = 4, FirstName = "James", LastName = "Jams"
                }
            };

            List <Baptizer> baptizers = new List <Baptizer>
            {
                TestFactories.GetBaptizer(),
                            b1
            };

            controller.CreateScheduleItem(schedule, DateTime.Now, TestFactories.GetDefaultPerson(), baptizers,
                                          TestFactories.GetDefaultPerson(), true, "test user");
            ScheduleItem item = schedule.ScheduleItems.First();

            baptizers = new List <Baptizer>
            {
                TestFactories.GetBaptizer(),
                    b2
            };

            controller.UpdateScheduleItem(schedule, item.ScheduleItemID, DateTime.Now, TestFactories.GetDefaultPerson(), baptizers,
                                          TestFactories.GetDefaultPerson(), true, "test user");

            Assert.AreEqual(item.Baptizers.Count, 2);
            Assert.IsTrue(item.Baptizers.Any(b => b.Person.PersonID == 2));
            Assert.IsTrue(item.Baptizers.Any(b => b.Person.PersonID == 4));
            Assert.IsFalse(item.Baptizers.Any(b => b.Person.PersonID == 3));
        }