public void TextFileDALCommitTest() { var mock = new Mock <IRepository>(); var dal = new TextFileDAL(mock.Object); dal.CommitChanges(); mock.Verify(x => x.CommitChanges(), Times.Exactly(1)); }
public void TextFileDALQueryTest() { var mock = new Mock <IRepository>(); mock.Setup(x => x.GetTypeRepostiory <string>()).Returns(new List <string>() { "foo", "bar" }); var dal = new TextFileDAL(mock.Object); var res = dal.Fetch <string>(x => x.Contains("ar")); Assert.IsTrue(res.Count == 1 && res[0] == "bar"); }
public void TextFileDALRemoveTest() { var mock = new Mock <IRepository>(); mock.Setup(x => x.GetTypeRepostiory <string>()).Returns(new List <string>() { "foo", "bar" }); var dal = new TextFileDAL(mock.Object); dal.Remove <string>("foo"); var newRep = new List <string>() { "bar" }; mock.Verify(x => x.SetTypeRepository <string>(newRep)); }