Пример #1
0
        private AppDbContext GetContext()
        {
            var context = InMemoryAppDbContext.GetEmptyUniqueAppDbContext();

            context.Avatars.Add(new AvatarInDb {
                Avatar = new byte[100], UserId = "421cb65f-a76d-4a73-8a1a-d792f37ef992"
            });


            context.SaveChanges();
            return(context);
        }
Пример #2
0
        private AppDbContext GetContext()
        {
            var context = InMemoryAppDbContext.GetEmptyUniqueAppDbContext();

            User user1 = new User {
                Id = "2138b181-4cee-4b85-9f16-18df308f387d", UserName = "******", NormalizedUserName = "******", PasswordHash = "MyPass", FirstName = "Bart", LastName = "Simpson", Email = "*****@*****.**", Info = "in-memory user"
            };
            User user2 = new User {
                Id = "2514591e-29f0-4a63-b0ad-87a3e7ebec3d", UserName = "******", NormalizedUserName = "******", PasswordHash = "MyPass", FirstName = "Lisa", LastName = "Simpson", Email = "*****@*****.**", Info = "in-memory user"
            };
            User user3 = new User {
                Id = "421cb65f-a76d-4a73-8a1a-d792f37ef992", UserName = "******", NormalizedUserName = "******", PasswordHash = "MyPass", FirstName = "Homer", LastName = "Simpson", Email = "*****@*****.**", Info = "in-memory user"
            };
            User user4 = new User {
                Id = "54bfd1f9-d379-4930-9c3b-4c84992c028e", UserName = "******", NormalizedUserName = "******", PasswordHash = "MyPass", FirstName = "Marge", LastName = "Simpson", Email = "*****@*****.**", Info = "in-memory user"
            };


            Project project1 = new Project {
                Id = 1, Name = "First Project", Description = "Some description to Project1"
            };
            Project project2 = new Project {
                Id = 2, Name = "Second Project", Description = "Some description to Project2"
            };


            ProjectUser pu1 = new ProjectUser {
                UserId = "2138b181-4cee-4b85-9f16-18df308f387d", ProjectId = 1, UserRoleId = AppUserRole.Owner.Id
            };
            ProjectUser pu2 = new ProjectUser {
                UserId = "2138b181-4cee-4b85-9f16-18df308f387d", ProjectId = 2, UserRoleId = AppUserRole.ScrumMaster.Id
            };
            ProjectUser pu3 = new ProjectUser {
                UserId = "2514591e-29f0-4a63-b0ad-87a3e7ebec3d", ProjectId = 2, UserRoleId = AppUserRole.Owner.Id
            };
            ProjectUser pu4 = new ProjectUser {
                UserId = "421cb65f-a76d-4a73-8a1a-d792f37ef992", ProjectId = 1, UserRoleId = AppUserRole.Developer.Id
            };

            context.Users.AddRange(new[] { user1, user2, user3, user4 });
            context.Projects.AddRange(new[] { project1, project2 });
            context.ProjectUsers.AddRange(new[] { pu1, pu2, pu3, pu4 });

            context.SaveChanges();
            return(context);
        }