public void EditTest() { ProjectTaskManagerEntities dbContext = new ProjectTaskManagerEntities(); var data = new List <tblUser>() { new tblUser() { User_id = 12 }, new tblUser() { User_id = 2 }, new tblUser() { User_id = 3 } }.AsQueryable(); var mockSet = new Mock <DbSet <tblUser> >(); mockSet.As <IQueryable <tblUser> >().Setup(m => m.Provider).Returns(data.Provider); mockSet.As <IQueryable <tblUser> >().Setup(m => m.Expression).Returns(data.Expression); mockSet.As <IQueryable <tblUser> >().Setup(m => m.ElementType).Returns(data.ElementType); dbContext.tblUsers = mockSet.Object; var service = new UserService(dbContext); var returnValue = service.Edit(new UserDO() { User_id = 12 }); Assert.NotNull(returnValue); }
public TaskServiceTests() { dbContext = new ProjectTaskManagerEntities(); }