title: Unit Test for Bank class in C#
body: <p>I'm learning to create unit tests for project written in C#. I've been follow the example on the MSDN website and now I just got stuck at how create a unit test when the amount is less than zero. The unit test is supposed to be failed when I run it. However, the way that I've written below, it passed :(
  Would someone please let me know what I need to do to fix it ? Thanks</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>        // unit test method
          [TestMethod]
          [ExpectedException(typeof(ArgumentOutOfRangeException))]
          public void Debit_WhenAmountIsLessThanZero_ShouldThrowArgumentOutOfRange()
          {
              // arrange
              double beginningBalance = 11.99;
              double debitAmount = -100.00;
  
  
              BankAccount account = new BankAccount("Mr. Bryan Walton", beginningBalance);
  
              // act
              account.Debit(debitAmount);
  
              // Not sure about this one
              // on my main program, I use if...else to handle
              // the situation when amount &gt; balance by throwing the exception
              double actual = account.Balance;
              Assert.IsTrue(actual &lt; 0, "Actual balance is greater than 0");            
          }
  </code></pre>
  
  <p>This is the method that I'm testing on</p>
  
  <pre><code>        public void Debit(double amount)
          {
              if (m_frozen)
              {
                  throw new Exception("Account frozen");
              }
  
              if (amount &gt; m_balance)
              {
                  throw new ArgumentOutOfRangeException("amount");
              }
  
              if (amount &lt; 0)
              {
                  throw new ArgumentOutOfRangeException("amount");
              }
  
              m_balance -= amount;
          }
  </code></pre>