public void SetupTables() { var mockUserData = new[] { new User { Id = Guid.NewGuid(), Username = "******", Email = "*****@*****.**", Password = Storage.EncryptPassword("somepassword"), }, }; var mockGroupData = new[] { new Group { Id = 1, Name = "PMI51", Deleted = false } }; /*var mockGroupUserData = new[] * { * new GroupUser {GroupRef = 1, UserRef = mockUserData[0].Id} * }; */ var mockUsers = new MockableTable <User>(Users.Object, mockUserData.AsQueryable()); var mockGroups = new MockableTable <Group>(Groups.Object, mockGroupData.AsQueryable()); //var mockGroupUsers = new MockableTable<GroupUser>(GroupUsers.Object, mockGroupUserData.AsQueryable()); MockDataContext.SetupGet(c => c.Users).Returns(mockUsers); MockDataContext.SetupGet(c => c.Groups).Returns(mockGroups); //MockDataContext.SetupGet(c => c.GroupUsers).Returns(mockGroupUsers); }
public void SetupTables() { var mockUserData = new[] { new User { Id = Guid.NewGuid(), Username = "******", Email = "*****@*****.**", Password = Storage.EncryptPassword("somepassword"), }, }; var mockGroupData = new[] { new Group { Id = 1, Name = "PMI51", Deleted = false } }; var mockGroupUserData = new[] { new GroupUser { GroupRef = 1, UserRef = mockUserData[0].Id } }; var mockUserRoleData = new[] { new UserRole { UserRef = mockUserData[0].Id, RoleRef = (int)Role.Teacher } }; var mockUsers = new MemoryTable <User>(mockUserData); var mockGroups = new MemoryTable <Group>(mockGroupData); var mockGroupUsers = new MemoryTable <GroupUser>(mockGroupUserData); var mockUserRoles = new MemoryTable <UserRole>(mockUserRoleData); MockDataContext.SetupGet(c => c.Users).Returns(mockUsers); MockDataContext.SetupGet(c => c.Groups).Returns(mockGroups); MockDataContext.SetupGet(c => c.GroupUsers).Returns(mockGroupUsers); MockDataContext.SetupGet(c => c.UserRoles).Returns(mockUserRoles); }
public void SetupTables() { var mockUserData = new[] { new User { Id = Guid.NewGuid(), Username = "******", }, new User { Id = new Guid("11345200-abe8-4f60-90c8-0d43c5f6c0f6"), Username = "******", }, new User { Id = new Guid("22345200-abe8-4f60-90c8-0d43c5f6c0f6"), Username = "******", }, new User { Id = Guid.NewGuid(), Username = "******", }, new User { Id = Guid.NewGuid(), Username = "******", }, new User { Id = new Guid("55345200-abe8-4f60-90c8-0d43c5f6c0f6"), Username = "******", }, new User { Id = new Guid("66345200-abe8-4f60-90c8-0d43c5f6c0f6"), Username = "******", }, }; MockDataContext.SetupGet(s => s.Users).Returns(new MemoryTable <User>(mockUserData)); var mockCourseData = new[] { new Course { Id = 1, Name = "Some course", Owner = "lex", Created = System.DateTime.Now, Updated = System.DateTime.Now, CourseUsers = new EntitySet <CourseUser>(), Deleted = false, Locked = null, Nodes = new EntitySet <Node>(), }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = false, Id = 2, Locked = null, Name = "#2", Nodes = new EntitySet <Node>(), Owner = "admin", Updated = System.DateTime.Now }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = true, Id = 7, Locked = null, Name = "#7", Nodes = new EntitySet <Node>(), Owner = "lex", Updated = System.DateTime.Now }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = false, Id = 3, Locked = null, Name = "#3", Nodes = new EntitySet <Node>(), Owner = "user1", Updated = System.DateTime.Now }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = true, Id = 4, Locked = null, Name = "#4", Nodes = new EntitySet <Node>(), Owner = "lex", Updated = System.DateTime.Now } }; MockDataContext.SetupGet(s => s.Courses).Returns(new MemoryTable <Course>(mockCourseData)); var mockCourseUserData = new[] { new CourseUser { Course = mockCourseData[0], CourseRef = mockCourseData[0].Id, UserRef = mockUserData[1].Id }, new CourseUser { Course = mockCourseData[0], CourseRef = mockCourseData[0].Id, UserRef = mockUserData[2].Id }, new CourseUser { Course = mockCourseData[0], CourseRef = mockCourseData[0].Id, UserRef = mockUserData[3].Id }, new CourseUser { Course = mockCourseData[1], CourseRef = mockCourseData[1].Id, UserRef = mockUserData[4].Id }, new CourseUser { Course = mockCourseData[2], CourseRef = mockCourseData[2].Id, UserRef = mockUserData[5].Id }, new CourseUser { Course = mockCourseData[3], CourseRef = mockCourseData[3].Id, UserRef = mockUserData[2].Id }, new CourseUser { Course = mockCourseData[4], CourseRef = mockCourseData[4].Id, UserRef = mockUserData[2].Id } }; MockDataContext.SetupGet(s => s.CourseUsers).Returns(new MemoryTable <CourseUser>(mockCourseUserData)); var mockNodeData = new[] { new Node { Course = mockCourseData[0], CourseId = mockCourseData[0].Id, Id = 0, IsFolder = false, Name = "Node for some cource" } }; MockDataContext.SetupGet(s => s.Nodes).Returns(new MemoryTable <Node>(mockNodeData)); var mockNodeResourceData = new[] { new NodeResource { Id = 0, Name = "something))" } }; MockDataContext.SetupGet(s => s.NodeResources).Returns(new MemoryTable <NodeResource>(mockNodeResourceData)); //var mockUsers = new MockableTable<User>(Users.Object, mockUserData.AsQueryable()); //var mockCourses = new MockableTable<Course>(Courses.Object, mockCourseData.AsQueryable()); //var mockCourseUsers = new MockableTable<CourseUser>(CourseUsers.Object, mockCourseUserData.AsQueryable()); //var mockNodes = new MockableTable<Node>(Nodes.Object, mockNodeData.AsQueryable()); //var mockNodeResources = new MockableTable<NodeResource>(NodeResources.Object, mockNodeResourceData.AsQueryable()); //MockDataContext.SetupGet(c => c.Users).Returns(mockUsers); //MockDataContext.SetupGet(c => c.Courses).Returns(mockCourses); //MockDataContext.SetupGet(c => c.CourseUsers).Returns(mockCourseUsers); //MockDataContext.SetupGet(c => c.Nodes).Returns(mockNodes); //MockDataContext.SetupGet(c => c.NodeResources).Returns(mockNodeResources); }
public void SetupTables() { var mockUserData = new[] { new User { Id = Guid.NewGuid(), Username = "******", Password = Storage.EncryptPassword("lex"), }, new User { Id = Guid.NewGuid(), Username = "******", Password = Storage.EncryptPassword("user1"), }, new User { Id = Guid.NewGuid(), Username = "******", Password = Storage.EncryptPassword("user2"), }, }; var mockCourseData = new[] { new Course { Id = 1, Name = "Some course", Owner = "lex", Created = System.DateTime.Now, Updated = System.DateTime.Now, CourseUsers = new EntitySet <CourseUser>(), Deleted = false, Locked = null, Nodes = new EntitySet <Node>(), }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = false, Id = 2, Locked = null, Name = "#2", Nodes = new EntitySet <Node>(), Owner = "lex", Updated = System.DateTime.Now }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = true, Id = 7, Locked = null, Name = "#7", Nodes = new EntitySet <Node>(), Owner = "lex", Updated = System.DateTime.Now }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = false, Id = 3, Locked = null, Name = "#3", Nodes = new EntitySet <Node>(), Owner = "user1", Updated = System.DateTime.Now }, new Course { CourseUsers = new EntitySet <CourseUser>(), Created = System.DateTime.Now, Deleted = true, Id = 4, Locked = null, Name = "#4", Nodes = new EntitySet <Node>(), Owner = "user2", Updated = System.DateTime.Now } }; var mockCourseUserData = new[] { new CourseUser { Course = mockCourseData[0], CourseRef = mockCourseData[0].Id, UserRef = mockUserData[0].Id }, new CourseUser { Course = mockCourseData[1], CourseRef = mockCourseData[1].Id, UserRef = mockUserData[0].Id }, new CourseUser { Course = mockCourseData[2], CourseRef = mockCourseData[2].Id, UserRef = mockUserData[0].Id }, new CourseUser { Course = mockCourseData[3], CourseRef = mockCourseData[3].Id, UserRef = mockUserData[1].Id }, new CourseUser { Course = mockCourseData[4], CourseRef = mockCourseData[4].Id, UserRef = mockUserData[2].Id } }; var mockNodeData = new[] { new Node { Course = mockCourseData[0], CourseId = mockCourseData[0].Id, Id = 0, IsFolder = false, Name = "Node for some cource" } }; var mockNodeResourceData = new[] { new NodeResource { Id = 0, Name = "something))" } }; var mockUsers = new MockableTable <User>(Users.Object, mockUserData.AsQueryable()); var mockCourses = new MockableTable <Course>(Courses.Object, mockCourseData.AsQueryable()); var mockCourseUsers = new MockableTable <CourseUser>(CourseUsers.Object, mockCourseUserData.AsQueryable()); var mockNodes = new MockableTable <Node>(Nodes.Object, mockNodeData.AsQueryable()); var mockNodeResources = new MockableTable <NodeResource>(NodeResources.Object, mockNodeResourceData.AsQueryable()); MockDataContext.SetupGet(c => c.Users).Returns(mockUsers); MockDataContext.SetupGet(c => c.Courses).Returns(mockCourses); MockDataContext.SetupGet(c => c.CourseUsers).Returns(mockCourseUsers); MockDataContext.SetupGet(c => c.Nodes).Returns(mockNodes); MockDataContext.SetupGet(c => c.NodeResources).Returns(mockNodeResources); }