dimanche 15 février 2015

How Tested this C# method

I search for this, but i have not found that i want. I have this method, and how can i test?



public class Service{
private IRepository repository;

public Service(IRepository repository){
this.repository = repository;
}

public IList<Item> ObtenerItems(int tipo) {
var spec = new ItemsDelDia(DateTime.Today);
if (tipo == 0)
spec &= new ItemsSinPago();
else
spec &= new ItemsPagados();
return this.repository.FindAll(spec.IsSatisfiedBy());
}
}


I mock Repository for UnitTest, but how i tested spec?


Thanks


Aucun commentaire:

Enregistrer un commentaire