//----------------------------------------------------------------------- // FILENAME: TrainingStubbedContext.cs // PROJECT: StubbedContextLib // SOLUTION: HeartTrack // DATE CREATED: 22/02/2024 // AUTHOR: Antoine PEREDERII //----------------------------------------------------------------------- using DbContextLib; using Entities; using Microsoft.EntityFrameworkCore; namespace StubbedContextLib { /// /// Represents the stubbed context for training entities. /// public class TrainingStubbedContext : StatisticStubbedContext { /// /// Initializes a new instance of the class. /// public TrainingStubbedContext() : base() { } /// /// Initializes a new instance of the class with the specified options. /// /// The options for the context. public TrainingStubbedContext(DbContextOptions options) : base(options) { } /// /// Configures the model for the training stubbed context. /// /// The model builder instance. protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( new TrainingEntity { IdTraining = 1, Date = new DateOnly(2024, 01, 19), Description = "Running", Latitude = 48.8566f, Longitude = 2.3522f, FeedBack = "Good" }, new TrainingEntity { IdTraining = 2, Date = new DateOnly(2024, 02, 20), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f }, new TrainingEntity { IdTraining = 3, Date = new DateOnly(2024, 02, 21), Latitude = 48.8566f, Longitude = 2.3522f, FeedBack = "Good" }, new TrainingEntity { IdTraining = 4, Date = new DateOnly(2024, 02, 22), Description = "Running", Latitude = 48.8566f, Longitude = 2.3522f, FeedBack = "Good" }, new TrainingEntity { IdTraining = 5, Date = new DateOnly(2024, 02, 23), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f } ); } } }