//-----------------------------------------------------------------------
// FILENAME: DataSourceStubbedContext.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 data sources.
///
public class DataSourceStubbedContext : AthleteStubbedContext
{
///
/// Initializes a new instance of the class.
///
public DataSourceStubbedContext() : base() { }
///
/// Initializes a new instance of the class with the specified options.
///
/// The options for the context.
public DataSourceStubbedContext(DbContextOptions options) : base(options) { }
///
/// Configures the model for the data source stubbed context.
///
/// The model builder instance.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity().HasData(
new DataSourceEntity { IdSource = 1, Type = "Smartwatch", Model = "Garmin", Precision = 0.5f },
new DataSourceEntity { IdSource = 2, Type = "Smartwatch", Model = "Polar", Precision = 0.5f },
new DataSourceEntity { IdSource = 3, Type = "Smartwatch", Model = "Suunto", Precision = 0.5f },
new DataSourceEntity { IdSource = 4, Type = "Smartwatch", Model = "Fitbit", Precision = 0.5f },
new DataSourceEntity { IdSource = 5, Type = "Smartwatch", Model = "Apple Watch", Precision = 0.5f }
);
}
}
}