Unit Test for Bank class in C# -


I am learning to learn unit tests for a project written in C #. I am following example on MSDN website and now how can I just make a unit test when the amount is less than zero. When I run this, the unit test is considered to be unsuccessful. However, the way I wrote it passed: (Will someone tell me what I need to do to fix it? Thank you

Even so far away from me: // Execution Method [Testimonation] [Expected Exceptions (Typef (ArgumentOutRain exception) Public Zero Debit_About I Mr. Bryan Walton ", StartBallance); // Act Account. Debit (debit Amount) ; // Your main work In rum, this one is not sure about //, I use it ... and / or handle the situation when the amount of equilibrium = by throwing an exception = account = equilibrium; affinity. Istru (real and lt ; 0, "the actual balance is greater than 0")}

This method is that I '(zero); (zero amount) {if (m_frozen) {new exception ("account Frozen ");} if (amount> m_balance) {throw new argument OUTOfRangeExcep}

  tion (" zodiac ");} if (amount & lt; 0) {new The O: AutoForranz exception ("zodiac");} M_balance - = sum;}    

test Okay, you expect an exception when the amount is negative and throw it, otherwise it will not pass though in such tests, I usually have something like this in the end.

  Fears (File "Exception should be thrown due .......")   

Exception is not thrown when it is expected , Then this assurance will fail in testing

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -