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")); }
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(); } }
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)); }