Example #1
0
        public void lets_do_some_stuff()
        {
            var id = "ihohihoihoihoihoihoijpoawehiohoi";
            var someNewAccountEvent = new AccountOpened
                                          {AccountId = id, InitialDeposit = 1000, On = DateTime.Now};
            var account = new Account(someNewAccountEvent);
            account.Deposit(45);
            account.Withdraw(17);

            _repository.Put(id,account);

            var accountFromRepo = _repository.Get(id);
            Assert.AreEqual(1000 + 45 -17,accountFromRepo._balance);
            //test to make sure we're not applying events multiple times
            _repository.Put(accountFromRepo.Id, accountFromRepo);
        }
Example #2
0
 public void create_account()
 {
     var accountOpenedEvent = new AccountOpened {AccountId = "lklhohiohoi", InitialDeposit = 100, On = DateTime.Now};
     var account = new Account(accountOpenedEvent);
     _repository.Put(accountOpenedEvent.AccountId,account);
 }