예제 #1
0
        public void Enable()
        {
            if (!_disabled)
            {
                throw new AggregateException(string.Format("User {0} is already enabled", _id));
            }

            ApplyChange(UserEvents.Enabled(_id));
        }
        public void Enable()
        {
            var id      = new UserId(Guid.NewGuid());
            var email   = "*****@*****.**";
            var metroId = 11;

            new CommandScenarioFor <User>(User.Factory)
            .Given(UserEvents.Created(email, id, metroId, false))
            .Given(UserEvents.Disabled(id))
            .When(user => user.Enable())
            .Then(UserEvents.Enabled(id))
            .Assert();
        }