示例#1
0
        public void Adding_an_attendee()
        {
            var sut = new Training();

            sut.RegisterAttendee("a", "ea");

            Equalidator.AreEqual(new[]{new Attendee{Name = "a", Email = "ea"}}, sut.Attendees);

            Assert.Throws<InvalidOperationException>(() => sut.RegisterAttendee("a", "ea"));
        }
示例#2
0
 public void Register_attendee(Training training, string name, string email, Action onSuccess, Action<string> onError)
 {
     Attendee a;
     if (training.TryGetAttendeeByEmail(email, out a))
         onError(string.Format("Email '{0}' has already been registered.", email));
     else
     {
         training.RegisterAttendee(name, email);
         onSuccess();
     }
 }
示例#3
0
        public void Retrieving_an_attendee()
        {
            var sut = new Training();

            sut.RegisterAttendee("a", "ea");

            Attendee a;
            Assert.IsTrue(sut.TryGetAttendeeByEmail("ea", out a));
            Assert.AreEqual("a", a.Name);

            Assert.IsFalse(sut.TryGetAttendeeByEmail("x", out a));
        }