The method Initialize() is never executed. I dont't understand why every methods are in public. MyContext is null in the test method. I tried 2 runners and I get the same behavior (Devexpress/CodeRush and Testdriven)
Here the code
[TestClass]
public class MyTests
{
public MyContext MyContext;
public MyRepository repo;
[TestInitialize]
public void Initialize()
{
MyContext = new MyContext();
repo = new MyRepository(MyContext);
}
[TestMethod]
public void MyTestMethod()
{
using (IUnitOfWork unitOfWork = new UnitOfWork(MyContext))
{
var myObject = new MyObject {
};
repo.Add(myObject);
unitOfWork.Commit();
}
}
}
Aucun commentaire:
Enregistrer un commentaire