Skip to content

Instantly share code, notes, and snippets.

@marcioalthmann
Last active August 29, 2015 14:04
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 marcioalthmann/d39ff70cac3bea628200 to your computer and use it in GitHub Desktop.
Save marcioalthmann/d39ff70cac3bea628200 to your computer and use it in GitHub Desktop.
Objeto2
public class Objeto
{
public int PrimeiroValor { get;set;}
public int SegundoValor { get;set;}
public int ObterSomaDosValores()
{
return PrimeiroValor + SegundoValor;
}
}
[TestFixture ()]
public class Test
{
[Test ()]
public void Somando_mais_de_uma_propriedade_com_auxilio_de_um_metodo()
{
var lista = new List<Objeto> ();
lista.Add (new Objeto{ PrimeiroValor = 10, SegundoValor = 20 });
lista.Add (new Objeto{ PrimeiroValor = 30, SegundoValor = 40 });
Assert.AreEqual (100, lista.Sum (x => x.ObterSomaDosValores()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment