Created
July 22, 2010 01:26
-
-
Save rmueller/485443 to your computer and use it in GitHub Desktop.
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 void DeveDar5PorcentoDeDescontoAVista(){ | |
var produto = new Mock<Produto>(); | |
produto.Setup(p => p.Preco).Return(10m); | |
var itemDaCompra = new ItemDaCompra(produto.Object); | |
// Verificação interna, desnecessária que cria um acoplamento maior que o necessário | |
produto.Verify(p => p.CalculeDescontoAVista(), Times.Once()); | |
AssertAreEqual(9.5m, itemDaCompra.ValorTotalItem); | |
} | |
public void DeveDar5PorcentoDeDescontoAVista(){ | |
// dada uma entrada | |
var produto = new Produto{Preco = 10m}; | |
// faço um processamento | |
var itemDaCompra = new ItemDaCompra(produto.Object); | |
// checo o resultado | |
AssertAreEqual(9.5m, itemDaCompra.ValorTotalItem); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment