protected internal virtual MartialArtist AcceptPromotion(Promotion promotion) { _promotions.Add(promotion); Rank = promotion.Rank; DomainEvents.Raise(new StudentPromoted(promotion.Instructor.Id,this.Id,promotion.Rank.Belt,promotion.Rank.Stripes)); return this; }
public void the_student_promoted_event_is_raised() { var rank = new Rank {Belt = "Blue"}; Action promoting_the_student = () => because_the_instructor_promoted_him_to(rank); promoting_the_student.ShouldHaveRaised<StudentPromoted>(e => { e.StudentId.ShouldEqual(_student.Id); e.Belt.ShouldEqual(rank.Belt); e.InstructorId.ShouldEqual(_instructor.Id); }); }
public StudentPromoted(Guid instructorId, Guid studentId, Rank rank) { InstructorId = instructorId; StudentId = studentId; Rank = rank; }
public void Promote(MartialArtist student, Rank rank) { var promotion = new Promotion {AwardedOn = DateTime.Now, Instructor = this, Rank = rank}; student.AcceptPromotion(promotion); }
public void the_students_promotion_is_recorded() { var rank = new Rank {Belt = "Blue"}; because_the_instructor_promoted_him_to(rank); _student.Promotions.ShouldHave(p => p.Instructor == _instructor && p.Rank.Equals(rank)); }
public void the_rank_of_the_student_changes_to_what_the_instructor_promoted_him_to() { var rank = new Rank {Belt = "White", Stripes = 0}; because_the_instructor_promoted_him_to(rank); _student.Rank.ShouldEqual(rank); }
public void because_the_instructor_promoted_him_to(Rank rank) { _instructor.Promote(_student,rank); }