vendredi 9 février 2018

In unit testing what is a repository?

How does creating a repository help me with unit testing? I am trying to create a unit test that is for a function that grabs information from a database using entity framework.

Here is an example function:

public ViewResult Index(){
 InfoModel model = new InfoModel();
 entity db = new entity();
 model.RowInformation = db.FirstName.ToList();
 return View(model)
}

In order to create a unit test I must remove the db entity and replace it with a repository. But I am trying to understand what a repository is can someone explain?

Aucun commentaire:

Enregistrer un commentaire