Last active
August 29, 2015 14:04
-
-
Save marcioalthmann/d39ff70cac3bea628200 to your computer and use it in GitHub Desktop.
Objeto2
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
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