Ejemplo n.º 1
0
        public void BroughtUser(string emailAddress)
        {
            var user = new MartialArtist(emailAddress);

            UsersBrought.Add(user);
            DomainEvents.Raise(new UserRegisterd(user.Id, emailAddress));
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public void Establish_context()
 {
     _instructor = new Instructor(null);
     _student    = new MartialArtist(null);
 }
 public StudentAlreadyRegisteredException(Dojo dojo, MartialArtist martialArtist)
 {
     Dojo          = dojo;
     MartialArtist = martialArtist;
 }