public TestPackage() { Tested = new UserDac(new ProjectManagementContextProvider(new PM_SQLEntities())); }
public TestPackage() { var user1 = new User { UserId = 1, FirstName = "Jordan", LastName = "Woodman", Email = "*****@*****.**", PhoneNumber = "4784425595", Passwords = new List<Password> { new Password { Hash = "Password", UserId = 1 } } }; var user2 = new User { UserId = 2, Email = "*****@*****.**" }; var users = new List<User> { user1, user2, new User { UserId = 3, Email = "*****@*****.**" } }; var passwords = new List<Password> { new Password { Hash = "*****@*****.**", UserId = 1 } }; var projects = new List<Project> { new Project { ProjectId = 1, UserId = 1, User = user1, Title = "Test", Description = "this is a description", StartDate = new DateTime(2015, 1, 1), EndDate = new DateTime(2015, 1, 2), Users = new List<User>{user2} } }; ProjectSetMock = new Mock<DbSet<Project>>().WithDefaultSetup(projects); UserSetMock = new Mock<DbSet<User>>().WithDefaultSetup(users); PasswordSetMock = new Mock<DbSet<Password>>().WithDefaultSetup(passwords); ContextProviderMock = new Mock<IProjectManagementContextProvider>() .WithProjects(ProjectSetMock) .WithUsers(UserSetMock) .WithPasswords(PasswordSetMock); Tested = new UserDac(ContextProviderMock.Object); }