Ejemplo n.º 1
0
        public void Deposit(decimal amount)
        {
            if (amount < 0)
            {
                throw new InvalidOperationException("Invalid amount value");
            }

            var depositSucceded = new DepositSuccededEvent(guid.ToString(), amount, EventReasons.NONE);

            Append(depositSucceded);
            Apply(depositSucceded);

            if (_state.Equals(AccountState.BLOCKED))
            {
                var unblockAccountEvent = new UnblockAccountCommand(guid.ToString());
                Append(unblockAccountEvent);
                Apply(unblockAccountEvent);
            }
        }
Ejemplo n.º 2
0
 private bool StateChanged()
 {
     return(!_lastName.Equals(Bot.AccountName) ||
            !_lastAccountState.Equals(Bot.AccountState) ||
            !_lasBotState.Equals(Bot.State) ||
            !_lastExpPerHour.Equals(ExpPerHour) ||
            !_lastLastLog.Equals(LastLog) ||
            !_lastRunTime.Equals(RunTime) ||
            !_lastTillLevelUp.Equals(TillLevelUp) ||
            !_lastLevel.Equals(Level));
 }
Ejemplo n.º 3
0
        public void TestAccountStateEquals()
        {
            RepositoryBag repositoryBag      = new RepositoryBag();
            DateTime      timestamp          = DateTime.Now;
            AccountState  accountState1      = new AccountState(1, 2, 123.45, timestamp, false, repositoryBag);
            AccountState  accountState1_copy = new AccountState(1, 2, 123.45, timestamp, false, repositoryBag);
            AccountState  accountState3      = new AccountState(2, 4, 246.9, timestamp, true, repositoryBag);

            Assert.True(accountState1 == accountState1_copy);
            Assert.True(accountState1.Equals(accountState1_copy));
            Assert.True(accountState1.Equals((object)accountState1_copy));
            Assert.False(accountState1.Equals("not equal"));
            Assert.False(accountState1.Equals((object)null));
            Assert.False(accountState1.Equals(accountState3));
            Assert.False(accountState1.Equals(null));

            Assert.True((AccountState)null == (AccountState)null);
            Assert.False((AccountState)null == (AccountState)accountState1);
            Assert.False((AccountState)accountState1 == (AccountState)null);
            Assert.False(accountState1 == accountState3);

            Assert.False((AccountState)null != (AccountState)null);
            Assert.True((AccountState)null != (AccountState)accountState1);
            Assert.True((AccountState)accountState1 != (AccountState)null);
            Assert.True(accountState1 != accountState3);
        }