You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
4.7 KiB
85 lines
4.7 KiB
using System.Security.Cryptography;
|
|
using DbContextLib;
|
|
using Entities;
|
|
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace StubbedContextLib;
|
|
|
|
public class StubbedContext : UserDbContext
|
|
{
|
|
public StubbedContext(DbContextOptions<UserDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
{
|
|
base.OnModelCreating(builder);
|
|
builder.Entity<UserEntity>().HasData(
|
|
new UserEntity(1, "johnny", Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
|
password: "motdepasse",
|
|
salt: RandomNumberGenerator.GetBytes(128 / 8),
|
|
prf: KeyDerivationPrf.HMACSHA256,
|
|
iterationCount: 100000,
|
|
numBytesRequested: 256 / 8)), "Johnny.RATTON@etu.uca.fr", true),
|
|
new UserEntity(2, "maxime", Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
|
password: "motdepasse",
|
|
salt: RandomNumberGenerator.GetBytes(128 / 8),
|
|
prf: KeyDerivationPrf.HMACSHA256,
|
|
iterationCount: 100000,
|
|
numBytesRequested: 256 / 8)), "Maxime.SAPOUNTZIS@etu.uca.fr", true),
|
|
new UserEntity(3, "clement", Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
|
password: "motdepasse",
|
|
salt: RandomNumberGenerator.GetBytes(128 / 8),
|
|
prf: KeyDerivationPrf.HMACSHA256,
|
|
iterationCount: 100000,
|
|
numBytesRequested: 256 / 8)), "Clement.CHIEU@etu.uca.fr", true),
|
|
new UserEntity(4, "erwan", Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
|
password: "motdepasse",
|
|
salt: RandomNumberGenerator.GetBytes(128 / 8),
|
|
prf: KeyDerivationPrf.HMACSHA256,
|
|
iterationCount: 100000,
|
|
numBytesRequested: 256 / 8)), "Erwan.MENAGER@etu.uca.fr", true),
|
|
new UserEntity(5, "victor", Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
|
password: "motdepasse",
|
|
salt: RandomNumberGenerator.GetBytes(128 / 8),
|
|
prf: KeyDerivationPrf.HMACSHA256,
|
|
iterationCount: 100000,
|
|
numBytesRequested: 256 / 8)), "Victor.GABORIT@etu.uca.fr", true));
|
|
|
|
builder.Entity<InquiryTableEntity>().HasData(
|
|
new InquiryTableEntity(1, "Inquiry1",
|
|
"Server=localhost;Database=Inquiry1;Trusted_Connection=True;MultipleActiveResultSets=true"),
|
|
new InquiryTableEntity(2, "Inquiry2",
|
|
"Server=localhost;Database=Inquiry2;Trusted_Connection=True;MultipleActiveResultSets=true"),
|
|
new InquiryTableEntity(3, "Inquiry3",
|
|
"Server=localhost;Database=Inquiry3;Trusted_Connection=True;MultipleActiveResultSets=true"));
|
|
|
|
builder.Entity<SolutionEntity>().HasData(
|
|
new SolutionEntity(1, "Maxime", "Sapountzis", "La cuisine", "Le couteau", "Parce que c'est Maxime"),
|
|
new SolutionEntity(2, "Johnny", "Ratton", "La cuisine", "Le couteau", "Parce que il est fou"),
|
|
new SolutionEntity(3, "Erwan", "Menager", "La salle de bain", "L'arachide", "Parce que c'est Erwan"));
|
|
|
|
builder.Entity<LessonEntity>().HasData(
|
|
new LessonEntity(1, "La cuisine", "Maxime", new DateOnly(2021, 10, 10)),
|
|
new LessonEntity(2, "La salle de bain", "Erwan", new DateOnly(2021, 10, 10)),
|
|
new LessonEntity(3, "La chambre", "Johnny", new DateOnly(2021, 10, 10)),
|
|
new LessonEntity(4, "Le salon", "Clement", new DateOnly(2021, 10, 10)));
|
|
|
|
builder.Entity<ParagraphEntity>().HasData(
|
|
new ParagraphEntity(1, "Le premier paragraphe", "Le contenu du premier paragraphe", "Attention", "La query",
|
|
"Le commentaire", 1),
|
|
new ParagraphEntity(2, "Le deuxième paragraphe", "Le contenu du deuxième paragraphe", "Attention",
|
|
"La query", "Le commentaire", 1),
|
|
new ParagraphEntity(3, "Le troisième paragraphe", "Le contenu du troisième paragraphe", "Attention",
|
|
"query", "commentaire", 2),
|
|
new ParagraphEntity(4, "Le quatrième paragraphe", "Le contenu du quatrième paragraphe", "Attention",
|
|
"La query", "Le commentaire", 3),
|
|
new ParagraphEntity(5, "Le cinquième paragraphe", "Le contenu du quatrième paragraphe", "Attention",
|
|
"La query", "Le commentaire", 4));
|
|
builder.Entity<InquiryEntity>().HasData(
|
|
new InquiryEntity(1, "L'enquête de la carotte", "La description de l'inquiry1", true),
|
|
new InquiryEntity(2, "L'enquête sur les orang outan", "The new description", false),
|
|
new InquiryEntity(3, "L'enquête sur les parapluies", "Il pleuvait", false));
|
|
}
|
|
} |