Skip to content

Instantly share code, notes, and snippets.

@marcel-valdez
Created August 23, 2012 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcel-valdez/3441375 to your computer and use it in GitHub Desktop.
Save marcel-valdez/3441375 to your computer and use it in GitHub Desktop.
Pueba unitaria de la clase Bank
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