I want to know is there any best practice in Unit Testing (C#/NUnit) to test solution like this: Imagine I have method GetOrderById(long orderId) in BLL (Business Logic Layer), which gives me an Order by it's Id :). So I need to write test that will call this method with hardcoded Id parameter, but for example var Id = 1; If there is no record with such id, test will fail
[Test]
public void GetOrderById()
{
//var id = ?
Assert.DoesNotThrow(() => {
_orderService.GetOrderById(id);
});
}
I need some solution to make work any time, create temporary record maybe? or smth better solution..
any ideas?
Aucun commentaire:
Enregistrer un commentaire