Exemplo n.º 1
0
        public void Promote(MartialArtist student, Rank rank)
        {
            var promotion = new Promotion {
                AwardedOn = DateTime.Now, Instructor = this, Rank = rank
            };

            student.AcceptPromotion(promotion);
        }
Exemplo n.º 2
0
 public virtual Dojo Register(MartialArtist martialArtist)
 {
     var registration = new Registration {StudentId = martialArtist.Id, Active = true, DojoId = Id};
     if (Registrations.Any(r => r.StudentId == martialArtist.Id))
         throw new StudentAlreadyRegisteredException(this, martialArtist);
     Registrations.Add(registration);
     DomainEvents.Raise(new StudentRegistered(Id,martialArtist.Id,DateTime.Now));
     return this;
 }
Exemplo n.º 3
0
 public void store_and_retrieve_a_martialartist()
 {
     var ma = new MartialArtist(null);
     _repo.Store(ma);
     _dbContainer.Close();
     var newContainer = Db4oFactory.OpenFile(dbFile);
     var repo2 = new Db4OAggrigateRootRepository<MartialArtist>(newContainer);
     var retrieved = repo2.GetById(ma.Id);
     retrieved.ShouldEqual(ma);
     newContainer.Close();
 }
Exemplo n.º 4
0
 public void Promote(MartialArtist student, Rank rank)
 {
     var promotion = new Promotion {AwardedOn = DateTime.Now, Instructor = this, Rank = rank};
     student.AcceptPromotion(promotion);
 }
 public StudentAlreadyRegisteredException(Dojo dojo, MartialArtist martialArtist)
 {
     Dojo = dojo;
     MartialArtist = martialArtist;
 }
 public void Establish_context()
 {
     _instructor = new Instructor(null);
     _student = new MartialArtist(null);
 }
Exemplo n.º 7
0
 public void BroughtUser(string emailAddress)
 {
     var user = new MartialArtist(emailAddress);
     UsersBrought.Add(user);
     DomainEvents.Raise(new UserRegisterd(user.Id, emailAddress));
 }