using AppContext.Entities; using Microsoft.EntityFrameworkCore; using Model; namespace StubContext; using AppContext; public class StubAppContext(DbContextOptions options) : AppContext(options) { public StubAppContext() : this( new DbContextOptionsBuilder() .UseSqlite("DataSource=database.db") .Options ) { } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); var users = new[] { "maxime", "mael", "yanis", "simon", "vivien" }.ToList(); var i = 0; builder.Entity() .HasData(users.ConvertAll(name => new UserEntity { Id = ++i, Email = $"{name}@mail.com", Name = name, Password = "123456", IsAdmin = true, ProfilePicture = "https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png", })); builder.Entity() .HasKey("TeamId", "UserId"); builder.Entity() .HasData(new TacticEntity() { Id = 1, Name = "New tactic", Type = CourtType.Plain, CreationDate = new DateTime(2024, 5, 31), OwnerId = 1, }); builder.Entity() .HasData(new TacticStepEntity { Id = 1, JsonContent = "{}", TacticId = 1, ParentId = null }); } }