Created
August 23, 2012 20:38
-
-
Save marcel-valdez/3441375 to your computer and use it in GitHub Desktop.
Pueba unitaria de la clase Bank
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Bank.UnitTest | |
{ | |
using System; | |
using NUnit.Framework; | |
[TestFixture] // El atributo TestFixture identifica a esta clase como una clase de pruebas | |
public class AccountTest | |
{ | |
[Test] // El atributo Test identifica a este método como una prueba unitaria | |
public void TransferFunds() | |
{ | |
Account source = new Account(); | |
source.Deposit(200m); | |
Account destination = new Account(); | |
destination.Deposit(150m); | |
source.TransferFunds(destination, 100m); | |
// Las aserciones se realizan por medio de la clase estática Assert | |
// En este caso se trata de una aserción de igualdad por medio del método | |
// estático AreEqual([valor esperado], [valor obtenido]) | |
Assert.AreEqual(250m, destination.Balance); | |
Assert.AreEqual(100m, source.Balance); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment