From b82b84b831fc50a39705c26910160421b2f1be84 Mon Sep 17 00:00:00 2001 From: anperederi Date: Thu, 22 Feb 2024 11:25:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20bugs=20with=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Entities/ActivityEntity.cs | 10 +- src/Entities/AthleteEntity.cs | 5 +- src/Entities/HeartRateEntity.cs | 3 +- src/Entities/NotificationEntity.cs | 3 +- src/Entities/StatisticEntity.cs | 3 +- src/Entities/TrainingEntity.cs | 3 +- .../ActivityStubbedContext.cs | 14 +-- .../AthleteStubbedContext.cs | 10 +- .../HeartRateStubbedContext.cs | 10 +- ...> 20240222102358_MyMigrations.Designer.cs} | 110 +++++++++--------- ...ions.cs => 20240222102358_MyMigrations.cs} | 78 ++++++------- .../TrainingStubbedContextModelSnapshot.cs | 108 ++++++++--------- .../NotificationStubbedContext.cs | 10 +- .../StatisticStubbedContext.cs | 10 +- .../TrainingStubbedContext.cs | 10 +- src/Tests/ConsoleTestEntities/Program.cs | 30 ++--- .../ConsoleTestEntities/uca.HeartTrack.db | Bin 45056 -> 45056 bytes 17 files changed, 207 insertions(+), 210 deletions(-) rename src/StubbedContextLib/Migrations/{20240222092302_MyMigrations.Designer.cs => 20240222102358_MyMigrations.Designer.cs} (82%) rename src/StubbedContextLib/Migrations/{20240222092302_MyMigrations.cs => 20240222102358_MyMigrations.cs} (64%) diff --git a/src/Entities/ActivityEntity.cs b/src/Entities/ActivityEntity.cs index 7d0c1a0..e3ae0e7 100644 --- a/src/Entities/ActivityEntity.cs +++ b/src/Entities/ActivityEntity.cs @@ -14,17 +14,15 @@ public class ActivityEntity [MaxLength(100)] public required string Type { get; set; } [Required(ErrorMessage = "Activity Date is required")] - [DataType(DataType.DateTime)] + // [DataType(DataType.DateTime)] [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)] - public DateTime Date { get; set; } + public DateOnly Date { get; set; } [Required(ErrorMessage = "Start Activity Hour is required")] - [DataType(DataType.DateTime)] [DisplayFormat(DataFormatString = "{0:HH:mm;ss}", ApplyFormatInEditMode = true)] - public DateTime StartTime { get; set; } + public TimeOnly StartTime { get; set; } [Required(ErrorMessage = "End Activity Hour is required")] - [DataType(DataType.DateTime)] [DisplayFormat(DataFormatString = "{0:HH:mm;ss}", ApplyFormatInEditMode = true)] - public DateTime EndTime { get; set; } + public TimeOnly EndTime { get; set; } public int EffortFelt { get; set; } public float Variability { get; set; } public float Variance { get; set; } diff --git a/src/Entities/AthleteEntity.cs b/src/Entities/AthleteEntity.cs index c547a45..17d2d86 100644 --- a/src/Entities/AthleteEntity.cs +++ b/src/Entities/AthleteEntity.cs @@ -24,6 +24,9 @@ public class AthleteEntity public double Lenght { get; set; } public float Weight { get; set; } public required string Password { get; set; } - public DateTime DateOfBirth { get; set; } + + [Required(ErrorMessage = "Athlete Date of Birth is required")] + [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] + public DateOnly DateOfBirth { get; set; } public bool IsCoach { get; set; } } \ No newline at end of file diff --git a/src/Entities/HeartRateEntity.cs b/src/Entities/HeartRateEntity.cs index 028f9d1..ed3651c 100644 --- a/src/Entities/HeartRateEntity.cs +++ b/src/Entities/HeartRateEntity.cs @@ -11,9 +11,8 @@ public class HeartRateEntity public int IdHeartRate { get; set; } public double Altitude { get; set; } [Required(ErrorMessage = "HeartRate Time is required")] - [DataType(DataType.DateTime)] [DisplayFormat(DataFormatString = "{0:HH:mm;ss}", ApplyFormatInEditMode = true)] - public DateTime Time { get; set; } + public TimeOnly Time { get; set; } public float Temperature { get; set; } public int Bpm { get; set; } public float Longitude { get; set; } diff --git a/src/Entities/NotificationEntity.cs b/src/Entities/NotificationEntity.cs index adecd52..058b0a7 100644 --- a/src/Entities/NotificationEntity.cs +++ b/src/Entities/NotificationEntity.cs @@ -13,8 +13,7 @@ public class NotificationEntity [Required] // dire obligatoire dans la base de données public string Message { get; set; } = null!; // pour dire pas null [Required(ErrorMessage = "Notification Date is required")] - [DataType(DataType.DateTime)] - [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy - HH}", ApplyFormatInEditMode = true)] + [DisplayFormat(DataFormatString = "{0:HH.mm.ss - HH.mm.ss}", ApplyFormatInEditMode = true)] public DateTime Date { get; set; } public bool Statut { get; set; } [MaxLength(100)] diff --git a/src/Entities/StatisticEntity.cs b/src/Entities/StatisticEntity.cs index 23cd2dc..340b76e 100644 --- a/src/Entities/StatisticEntity.cs +++ b/src/Entities/StatisticEntity.cs @@ -14,7 +14,6 @@ public class StatisticEntity public double MaximumHeartRate { get; set; } public double AverageCaloriesBurned { get; set; } [Required(ErrorMessage = "Satistic Date is required")] - [DataType(DataType.DateTime)] [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)] - public DateTime Date { get; set; } + public DateOnly Date { get; set; } } \ No newline at end of file diff --git a/src/Entities/TrainingEntity.cs b/src/Entities/TrainingEntity.cs index 2f6644e..0a057bc 100644 --- a/src/Entities/TrainingEntity.cs +++ b/src/Entities/TrainingEntity.cs @@ -12,9 +12,8 @@ public class TrainingEntity [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdTraining { get; set; } [Required(ErrorMessage = "Training Date is required")] - [DataType(DataType.DateTime)] [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)] - public DateTime Date { get; set; } + public DateOnly Date { get; set; } [MaxLength(300)] public string? Description { get; set; } public float Latitude { get; set; } diff --git a/src/StubbedContextLib/ActivityStubbedContext.cs b/src/StubbedContextLib/ActivityStubbedContext.cs index 11f8457..d97cfdf 100644 --- a/src/StubbedContextLib/ActivityStubbedContext.cs +++ b/src/StubbedContextLib/ActivityStubbedContext.cs @@ -19,13 +19,13 @@ public class ActivityStubbedContext : LibraryContext base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new ActivityEntity { IdActivity = 1, Type = "Running", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, - new ActivityEntity { IdActivity = 2, Type = "Cycling", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, - new ActivityEntity { IdActivity = 3, Type = "Swimming", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, - new ActivityEntity { IdActivity = 4, Type = "Walking", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, - new ActivityEntity { IdActivity = 5, Type = "Hiking", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, - new ActivityEntity { IdActivity = 6, Type = "Climbing", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, - new ActivityEntity { IdActivity = 7, Type = "Yoga", Date = new DateTime(), StartTime = new DateTime(), EndTime = new DateTime(), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false } + new ActivityEntity { IdActivity = 1, Type = "Running", Date = new DateOnly(2023, 01, 10), StartTime = new TimeOnly(13, 00, 34), EndTime = new TimeOnly(14, 00, 22), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, + new ActivityEntity { IdActivity = 2, Type = "Cycling", Date = new DateOnly(2023, 01, 25), StartTime = new TimeOnly(13, 04, 34), EndTime = new TimeOnly(14, 00, 22), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, + new ActivityEntity { IdActivity = 3, Type = "Swimming", Date = new DateOnly(2023, 12, 10), StartTime = new TimeOnly(13, 30, 34), EndTime = new TimeOnly(15, 02, 22), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, + new ActivityEntity { IdActivity = 4, Type = "Walking", Date = new DateOnly(2024, 01, 02), StartTime = new TimeOnly(15, 00, 00), EndTime = new TimeOnly(16, 01, 55), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, + new ActivityEntity { IdActivity = 5, Type = "Hiking", Date = new DateOnly(2024, 01, 12), StartTime = new TimeOnly(07, 45, 34), EndTime = new TimeOnly(09, 00, 22), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, + new ActivityEntity { IdActivity = 6, Type = "Climbing", Date = new DateOnly(2024, 01, 27), StartTime = new TimeOnly(13, 30, 01), EndTime = new TimeOnly(14, 00, 22), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false }, + new ActivityEntity { IdActivity = 7, Type = "Yoga", Date = new DateOnly(2024, 02, 22), StartTime = new TimeOnly(22, 00, 34), EndTime = new TimeOnly(23, 50, 58), EffortFelt = 5, Variability = 0.5f, Variance = 0.5f, StandardDeviation = 0.5f, Average = 0.5f, Maximum = 0, Minimum = 0, AverageTemperature = 20.0f, HasAutoPause = false } ); } } \ No newline at end of file diff --git a/src/StubbedContextLib/AthleteStubbedContext.cs b/src/StubbedContextLib/AthleteStubbedContext.cs index 4f01ed9..2593eb7 100644 --- a/src/StubbedContextLib/AthleteStubbedContext.cs +++ b/src/StubbedContextLib/AthleteStubbedContext.cs @@ -19,11 +19,11 @@ public class AthleteStubbedContext : ActivityStubbedContext base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new AthleteEntity { IdAthlete = 1, Username = "Doe", LastName = "Doe", FirstName = "John", Email = "john.doe@example.com", Password = "password123", Sexe = "M", Lenght = 1.80, Weight = 75, DateOfBirth = new DateTime(), IsCoach = true }, - new AthleteEntity { IdAthlete = 2, Username = "Smith", LastName = "Smith", FirstName = "Jane", Email = "jane.smith@example.com", Password = "secure456", Sexe = "F", Lenght = 1.65, Weight = 60, DateOfBirth = new DateTime(), IsCoach = false }, - new AthleteEntity { IdAthlete = 3, Username = "Martin", LastName = "Martin", FirstName = "Paul", Email = "paul.martin@example.com", Password = "super789", Sexe = "M", Lenght = 1.75, Weight = 68, DateOfBirth = new DateTime(), IsCoach = true }, - new AthleteEntity { IdAthlete = 4, Username = "Brown", LastName = "Brown", FirstName = "Anna", Email = "anna.brown@example.com", Password = "test000", Sexe = "F", Lenght = 1.70, Weight = 58, DateOfBirth = new DateTime(), IsCoach = false }, - new AthleteEntity { IdAthlete = 5, Username = "Lee", LastName = "Lee", FirstName ="Bruce", Email = "bruce.lee@example.com", Password = "hello321", Sexe = "M", Lenght = 2.0, Weight = 90, DateOfBirth = new DateTime(), IsCoach = false } + new AthleteEntity { IdAthlete = 1, Username = "Doe", LastName = "Doe", FirstName = "John", Email = "john.doe@example.com", Password = "password123", Sexe = "M", Lenght = 1.80, Weight = 75, DateOfBirth = new DateOnly(1990, 01, 01), IsCoach = true }, + new AthleteEntity { IdAthlete = 2, Username = "Smith", LastName = "Smith", FirstName = "Jane", Email = "jane.smith@exemple.com", Password = "secure456", Sexe = "F", Lenght = 1.65, Weight = 60, DateOfBirth = new DateOnly(1995, 01, 01), IsCoach = false }, + new AthleteEntity { IdAthlete = 3, Username = "Martin", LastName = "Martin", FirstName = "Paul", Email = "paul.martin@example.com", Password = "super789", Sexe = "M", Lenght = 1.75, Weight = 68, DateOfBirth = new DateOnly(1992, 01, 01), IsCoach = true }, + new AthleteEntity { IdAthlete = 4, Username = "Brown", LastName = "Brown", FirstName = "Anna", Email = "anna.brown@example.com", Password = "test000", Sexe = "F", Lenght = 1.70, Weight = 58, DateOfBirth = new DateOnly(1993, 01, 01), IsCoach = false }, + new AthleteEntity { IdAthlete = 5, Username = "Lee", LastName = "Lee", FirstName ="Bruce", Email = "bruce.lee@example.com", Password = "hello321", Sexe = "M", Lenght = 2.0, Weight = 90, DateOfBirth = new DateOnly(1991, 01, 01), IsCoach = false } ); } } \ No newline at end of file diff --git a/src/StubbedContextLib/HeartRateStubbedContext.cs b/src/StubbedContextLib/HeartRateStubbedContext.cs index 0f6c3ac..8c71e01 100644 --- a/src/StubbedContextLib/HeartRateStubbedContext.cs +++ b/src/StubbedContextLib/HeartRateStubbedContext.cs @@ -19,11 +19,11 @@ public class HeartRateStubbedContext : DataSourceStubbedContext base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new HeartRateEntity { IdHeartRate = 1, Altitude = 0.0, Time = new DateTime(), Temperature = 20.0f, Bpm = 60, Longitude = 35f, Latitude = 66f }, - new HeartRateEntity { IdHeartRate = 2, Altitude = 10, Time = new DateTime(), Temperature = 20.5f, Bpm = 65, Longitude = 35f, Latitude = 67f }, - new HeartRateEntity { IdHeartRate = 3, Altitude = 11, Time = new DateTime(), Temperature = 20.0f, Bpm = 71, Longitude = 36f, Latitude = 66f }, - new HeartRateEntity { IdHeartRate = 4, Altitude = 12, Time = new DateTime(), Temperature = 20.5f, Bpm = 75, Longitude = 36f, Latitude = 67f }, - new HeartRateEntity { IdHeartRate = 5, Altitude = 13, Time = new DateTime(), Temperature = 20.0f, Bpm = 80, Longitude = 37f, Latitude = 66f } + new HeartRateEntity { IdHeartRate = 1, Altitude = 0.0, Time = new TimeOnly(13, 00, 30), Temperature = 20.0f, Bpm = 60, Longitude = 35f, Latitude = 66f }, + new HeartRateEntity { IdHeartRate = 2, Altitude = 10, Time = new TimeOnly(13, 00, 31), Temperature = 20.5f, Bpm = 65, Longitude = 35f, Latitude = 67f }, + new HeartRateEntity { IdHeartRate = 3, Altitude = 11, Time = new TimeOnly(13, 00, 32), Temperature = 20.0f, Bpm = 71, Longitude = 36f, Latitude = 66f }, + new HeartRateEntity { IdHeartRate = 4, Altitude = 12, Time = new TimeOnly(13, 00, 33), Temperature = 20.5f, Bpm = 75, Longitude = 36f, Latitude = 67f }, + new HeartRateEntity { IdHeartRate = 5, Altitude = 13, Time = new TimeOnly(13, 00, 34), Temperature = 20.0f, Bpm = 80, Longitude = 37f, Latitude = 66f } ); } } \ No newline at end of file diff --git a/src/StubbedContextLib/Migrations/20240222092302_MyMigrations.Designer.cs b/src/StubbedContextLib/Migrations/20240222102358_MyMigrations.Designer.cs similarity index 82% rename from src/StubbedContextLib/Migrations/20240222092302_MyMigrations.Designer.cs rename to src/StubbedContextLib/Migrations/20240222102358_MyMigrations.Designer.cs index 0a34c38..3337f41 100644 --- a/src/StubbedContextLib/Migrations/20240222092302_MyMigrations.Designer.cs +++ b/src/StubbedContextLib/Migrations/20240222102358_MyMigrations.Designer.cs @@ -11,7 +11,7 @@ using StubbedContextLib; namespace StubbedContextLib.Migrations { [DbContext(typeof(TrainingStubbedContext))] - [Migration("20240222092302_MyMigrations")] + [Migration("20240222102358_MyMigrations")] partial class MyMigrations { /// @@ -32,13 +32,13 @@ namespace StubbedContextLib.Migrations b.Property("AverageTemperature") .HasColumnType("REAL"); - b.Property("Date") + b.Property("Date") .HasColumnType("TEXT"); b.Property("EffortFelt") .HasColumnType("INTEGER"); - b.Property("EndTime") + b.Property("EndTime") .HasColumnType("TEXT"); b.Property("HasAutoPause") @@ -53,7 +53,7 @@ namespace StubbedContextLib.Migrations b.Property("StandardDeviation") .HasColumnType("REAL"); - b.Property("StartTime") + b.Property("StartTime") .HasColumnType("TEXT"); b.Property("Type") @@ -77,14 +77,14 @@ namespace StubbedContextLib.Migrations IdActivity = 1, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 1, 10), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(14, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 0, 34), Type = "Running", Variability = 0.5f, Variance = 0.5f @@ -94,14 +94,14 @@ namespace StubbedContextLib.Migrations IdActivity = 2, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 1, 25), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(14, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 4, 34), Type = "Cycling", Variability = 0.5f, Variance = 0.5f @@ -111,14 +111,14 @@ namespace StubbedContextLib.Migrations IdActivity = 3, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 12, 10), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(15, 2, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 30, 34), Type = "Swimming", Variability = 0.5f, Variance = 0.5f @@ -128,14 +128,14 @@ namespace StubbedContextLib.Migrations IdActivity = 4, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 2), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(16, 1, 55), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(15, 0, 0), Type = "Walking", Variability = 0.5f, Variance = 0.5f @@ -145,14 +145,14 @@ namespace StubbedContextLib.Migrations IdActivity = 5, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 12), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(9, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(7, 45, 34), Type = "Hiking", Variability = 0.5f, Variance = 0.5f @@ -162,14 +162,14 @@ namespace StubbedContextLib.Migrations IdActivity = 6, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 27), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(14, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 30, 1), Type = "Climbing", Variability = 0.5f, Variance = 0.5f @@ -179,14 +179,14 @@ namespace StubbedContextLib.Migrations IdActivity = 7, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 22), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(23, 50, 58), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(22, 0, 34), Type = "Yoga", Variability = 0.5f, Variance = 0.5f @@ -199,7 +199,7 @@ namespace StubbedContextLib.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("DateOfBirth") + b.Property("DateOfBirth") .HasColumnType("TEXT"); b.Property("Email") @@ -248,7 +248,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 1, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1990, 1, 1), Email = "john.doe@example.com", FirstName = "John", IsCoach = true, @@ -262,8 +262,8 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 2, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - Email = "jane.smith@example.com", + DateOfBirth = new DateOnly(1995, 1, 1), + Email = "jane.smith@exemple.com", FirstName = "Jane", IsCoach = false, LastName = "Smith", @@ -276,7 +276,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 3, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1992, 1, 1), Email = "paul.martin@example.com", FirstName = "Paul", IsCoach = true, @@ -290,7 +290,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 4, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1993, 1, 1), Email = "anna.brown@example.com", FirstName = "Anna", IsCoach = false, @@ -304,7 +304,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 5, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1991, 1, 1), Email = "bruce.lee@example.com", FirstName = "Bruce", IsCoach = false, @@ -399,7 +399,7 @@ namespace StubbedContextLib.Migrations b.Property("Temperature") .HasColumnType("REAL"); - b.Property("Time") + b.Property("Time") .HasColumnType("TEXT"); b.HasKey("IdHeartRate"); @@ -415,7 +415,7 @@ namespace StubbedContextLib.Migrations Latitude = 66f, Longitude = 35f, Temperature = 20f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 30) }, new { @@ -425,7 +425,7 @@ namespace StubbedContextLib.Migrations Latitude = 67f, Longitude = 35f, Temperature = 20.5f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 31) }, new { @@ -435,7 +435,7 @@ namespace StubbedContextLib.Migrations Latitude = 66f, Longitude = 36f, Temperature = 20f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 32) }, new { @@ -445,7 +445,7 @@ namespace StubbedContextLib.Migrations Latitude = 67f, Longitude = 36f, Temperature = 20.5f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 33) }, new { @@ -455,7 +455,7 @@ namespace StubbedContextLib.Migrations Latitude = 66f, Longitude = 37f, Temperature = 20f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 34) }); }); @@ -489,7 +489,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 1, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2023, 12, 25, 13, 0, 40, 0, DateTimeKind.Unspecified), Message = "You have a new activity to check", Statut = true, Urgence = "A" @@ -497,7 +497,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 2, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2023, 12, 26, 13, 10, 40, 0, DateTimeKind.Unspecified), Message = "You have a new athlete to check", Statut = false, Urgence = "3" @@ -505,7 +505,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 3, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2023, 12, 26, 16, 10, 4, 0, DateTimeKind.Unspecified), Message = "You have a new heart rate to check", Statut = true, Urgence = "2" @@ -513,7 +513,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 4, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2024, 1, 12, 9, 30, 50, 0, DateTimeKind.Unspecified), Message = "You have a new data source to check", Statut = false, Urgence = "1" @@ -521,7 +521,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 5, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2024, 2, 22, 12, 10, 0, 0, DateTimeKind.Unspecified), Message = "You have a new notification to check", Statut = true, Urgence = "3" @@ -540,7 +540,7 @@ namespace StubbedContextLib.Migrations b.Property("AverageHeartRate") .HasColumnType("REAL"); - b.Property("Date") + b.Property("Date") .HasColumnType("TEXT"); b.Property("MaximumHeartRate") @@ -559,7 +559,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 1, AverageCaloriesBurned = 500.0, AverageHeartRate = 120.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2021, 12, 12), MaximumHeartRate = 180.0, Weight = 75f }, @@ -568,7 +568,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 2, AverageCaloriesBurned = 600.0, AverageHeartRate = 130.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2021, 1, 11), MaximumHeartRate = 190.0, Weight = 60f }, @@ -577,7 +577,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 3, AverageCaloriesBurned = 550.0, AverageHeartRate = 125.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2022, 12, 30), MaximumHeartRate = 185.0, Weight = 68f }, @@ -586,7 +586,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 4, AverageCaloriesBurned = 650.0, AverageHeartRate = 135.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 2, 20), MaximumHeartRate = 195.0, Weight = 58f }, @@ -595,7 +595,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 5, AverageCaloriesBurned = 450.0, AverageHeartRate = 110.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 10), MaximumHeartRate = 170.0, Weight = 90f }); @@ -607,7 +607,7 @@ namespace StubbedContextLib.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("Date") + b.Property("Date") .HasColumnType("TEXT"); b.Property("Description") @@ -632,7 +632,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 1, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 19), Description = "Running", FeedBack = "Good", Latitude = 48.8566f, @@ -641,7 +641,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 2, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 20), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f @@ -649,7 +649,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 3, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 21), FeedBack = "Good", Latitude = 48.8566f, Longitude = 2.3522f @@ -657,7 +657,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 4, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 22), Description = "Running", FeedBack = "Good", Latitude = 48.8566f, @@ -666,7 +666,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 5, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 23), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f diff --git a/src/StubbedContextLib/Migrations/20240222092302_MyMigrations.cs b/src/StubbedContextLib/Migrations/20240222102358_MyMigrations.cs similarity index 64% rename from src/StubbedContextLib/Migrations/20240222092302_MyMigrations.cs rename to src/StubbedContextLib/Migrations/20240222102358_MyMigrations.cs index 1326864..39001c0 100644 --- a/src/StubbedContextLib/Migrations/20240222092302_MyMigrations.cs +++ b/src/StubbedContextLib/Migrations/20240222102358_MyMigrations.cs @@ -20,9 +20,9 @@ namespace StubbedContextLib.Migrations IdActivity = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Type = table.Column(type: "TEXT", maxLength: 100, nullable: false), - Date = table.Column(type: "TEXT", nullable: false), - StartTime = table.Column(type: "TEXT", nullable: false), - EndTime = table.Column(type: "TEXT", nullable: false), + Date = table.Column(type: "TEXT", nullable: false), + StartTime = table.Column(type: "TEXT", nullable: false), + EndTime = table.Column(type: "TEXT", nullable: false), EffortFelt = table.Column(type: "INTEGER", nullable: false), Variability = table.Column(type: "REAL", nullable: false), Variance = table.Column(type: "REAL", nullable: false), @@ -52,7 +52,7 @@ namespace StubbedContextLib.Migrations Lenght = table.Column(type: "REAL", nullable: false), Weight = table.Column(type: "REAL", nullable: false), Password = table.Column(type: "TEXT", nullable: false), - DateOfBirth = table.Column(type: "TEXT", nullable: false), + DateOfBirth = table.Column(type: "TEXT", nullable: false), IsCoach = table.Column(type: "INTEGER", nullable: false) }, constraints: table => @@ -82,7 +82,7 @@ namespace StubbedContextLib.Migrations IdHeartRate = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Altitude = table.Column(type: "REAL", nullable: false), - Time = table.Column(type: "TEXT", nullable: false), + Time = table.Column(type: "TEXT", nullable: false), Temperature = table.Column(type: "REAL", nullable: false), Bpm = table.Column(type: "INTEGER", nullable: false), Longitude = table.Column(type: "REAL", nullable: false), @@ -119,7 +119,7 @@ namespace StubbedContextLib.Migrations AverageHeartRate = table.Column(type: "REAL", nullable: false), MaximumHeartRate = table.Column(type: "REAL", nullable: false), AverageCaloriesBurned = table.Column(type: "REAL", nullable: false), - Date = table.Column(type: "TEXT", nullable: false) + Date = table.Column(type: "TEXT", nullable: false) }, constraints: table => { @@ -132,7 +132,7 @@ namespace StubbedContextLib.Migrations { IdTraining = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), - Date = table.Column(type: "TEXT", nullable: false), + Date = table.Column(type: "TEXT", nullable: false), Description = table.Column(type: "TEXT", maxLength: 300, nullable: true), Latitude = table.Column(type: "REAL", nullable: false), Longitude = table.Column(type: "REAL", nullable: false), @@ -148,13 +148,13 @@ namespace StubbedContextLib.Migrations columns: new[] { "IdActivity", "Average", "AverageTemperature", "Date", "EffortFelt", "EndTime", "HasAutoPause", "Maximum", "Minimum", "StandardDeviation", "StartTime", "Type", "Variability", "Variance" }, values: new object[,] { - { 1, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Running", 0.5f, 0.5f }, - { 2, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cycling", 0.5f, 0.5f }, - { 3, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Swimming", 0.5f, 0.5f }, - { 4, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Walking", 0.5f, 0.5f }, - { 5, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Hiking", 0.5f, 0.5f }, - { 6, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Climbing", 0.5f, 0.5f }, - { 7, 0.5f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), false, 0, 0, 0.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Yoga", 0.5f, 0.5f } + { 1, 0.5f, 20f, new DateOnly(2023, 1, 10), 5, new TimeOnly(14, 0, 22), false, 0, 0, 0.5f, new TimeOnly(13, 0, 34), "Running", 0.5f, 0.5f }, + { 2, 0.5f, 20f, new DateOnly(2023, 1, 25), 5, new TimeOnly(14, 0, 22), false, 0, 0, 0.5f, new TimeOnly(13, 4, 34), "Cycling", 0.5f, 0.5f }, + { 3, 0.5f, 20f, new DateOnly(2023, 12, 10), 5, new TimeOnly(15, 2, 22), false, 0, 0, 0.5f, new TimeOnly(13, 30, 34), "Swimming", 0.5f, 0.5f }, + { 4, 0.5f, 20f, new DateOnly(2024, 1, 2), 5, new TimeOnly(16, 1, 55), false, 0, 0, 0.5f, new TimeOnly(15, 0, 0), "Walking", 0.5f, 0.5f }, + { 5, 0.5f, 20f, new DateOnly(2024, 1, 12), 5, new TimeOnly(9, 0, 22), false, 0, 0, 0.5f, new TimeOnly(7, 45, 34), "Hiking", 0.5f, 0.5f }, + { 6, 0.5f, 20f, new DateOnly(2024, 1, 27), 5, new TimeOnly(14, 0, 22), false, 0, 0, 0.5f, new TimeOnly(13, 30, 1), "Climbing", 0.5f, 0.5f }, + { 7, 0.5f, 20f, new DateOnly(2024, 2, 22), 5, new TimeOnly(23, 50, 58), false, 0, 0, 0.5f, new TimeOnly(22, 0, 34), "Yoga", 0.5f, 0.5f } }); migrationBuilder.InsertData( @@ -162,11 +162,11 @@ namespace StubbedContextLib.Migrations columns: new[] { "IdAthlete", "DateOfBirth", "Email", "FirstName", "IsCoach", "LastName", "Lenght", "Password", "Sexe", "Username", "Weight" }, values: new object[,] { - { 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "john.doe@example.com", "John", true, "Doe", 1.8, "password123", "M", "Doe", 75f }, - { 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "jane.smith@example.com", "Jane", false, "Smith", 1.6499999999999999, "secure456", "F", "Smith", 60f }, - { 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "paul.martin@example.com", "Paul", true, "Martin", 1.75, "super789", "M", "Martin", 68f }, - { 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "anna.brown@example.com", "Anna", false, "Brown", 1.7, "test000", "F", "Brown", 58f }, - { 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "bruce.lee@example.com", "Bruce", false, "Lee", 2.0, "hello321", "M", "Lee", 90f } + { 1, new DateOnly(1990, 1, 1), "john.doe@example.com", "John", true, "Doe", 1.8, "password123", "M", "Doe", 75f }, + { 2, new DateOnly(1995, 1, 1), "jane.smith@exemple.com", "Jane", false, "Smith", 1.6499999999999999, "secure456", "F", "Smith", 60f }, + { 3, new DateOnly(1992, 1, 1), "paul.martin@example.com", "Paul", true, "Martin", 1.75, "super789", "M", "Martin", 68f }, + { 4, new DateOnly(1993, 1, 1), "anna.brown@example.com", "Anna", false, "Brown", 1.7, "test000", "F", "Brown", 58f }, + { 5, new DateOnly(1991, 1, 1), "bruce.lee@example.com", "Bruce", false, "Lee", 2.0, "hello321", "M", "Lee", 90f } }); migrationBuilder.InsertData( @@ -186,11 +186,11 @@ namespace StubbedContextLib.Migrations columns: new[] { "IdHeartRate", "Altitude", "Bpm", "Latitude", "Longitude", "Temperature", "Time" }, values: new object[,] { - { 1, 0.0, 60, 66f, 35f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, - { 2, 10.0, 65, 67f, 35f, 20.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, - { 3, 11.0, 71, 66f, 36f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, - { 4, 12.0, 75, 67f, 36f, 20.5f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }, - { 5, 13.0, 80, 66f, 37f, 20f, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) } + { 1, 0.0, 60, 66f, 35f, 20f, new TimeOnly(13, 0, 30) }, + { 2, 10.0, 65, 67f, 35f, 20.5f, new TimeOnly(13, 0, 31) }, + { 3, 11.0, 71, 66f, 36f, 20f, new TimeOnly(13, 0, 32) }, + { 4, 12.0, 75, 67f, 36f, 20.5f, new TimeOnly(13, 0, 33) }, + { 5, 13.0, 80, 66f, 37f, 20f, new TimeOnly(13, 0, 34) } }); migrationBuilder.InsertData( @@ -198,11 +198,11 @@ namespace StubbedContextLib.Migrations columns: new[] { "IdNotif", "Date", "Message", "Statut", "Urgence" }, values: new object[,] { - { 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new activity to check", true, "A" }, - { 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new athlete to check", false, "3" }, - { 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new heart rate to check", true, "2" }, - { 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new data source to check", false, "1" }, - { 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "You have a new notification to check", true, "3" } + { 1, new DateTime(2023, 12, 25, 13, 0, 40, 0, DateTimeKind.Unspecified), "You have a new activity to check", true, "A" }, + { 2, new DateTime(2023, 12, 26, 13, 10, 40, 0, DateTimeKind.Unspecified), "You have a new athlete to check", false, "3" }, + { 3, new DateTime(2023, 12, 26, 16, 10, 4, 0, DateTimeKind.Unspecified), "You have a new heart rate to check", true, "2" }, + { 4, new DateTime(2024, 1, 12, 9, 30, 50, 0, DateTimeKind.Unspecified), "You have a new data source to check", false, "1" }, + { 5, new DateTime(2024, 2, 22, 12, 10, 0, 0, DateTimeKind.Unspecified), "You have a new notification to check", true, "3" } }); migrationBuilder.InsertData( @@ -210,11 +210,11 @@ namespace StubbedContextLib.Migrations columns: new[] { "IdStatistic", "AverageCaloriesBurned", "AverageHeartRate", "Date", "MaximumHeartRate", "Weight" }, values: new object[,] { - { 1, 500.0, 120.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 180.0, 75f }, - { 2, 600.0, 130.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 190.0, 60f }, - { 3, 550.0, 125.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 185.0, 68f }, - { 4, 650.0, 135.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 195.0, 58f }, - { 5, 450.0, 110.0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 170.0, 90f } + { 1, 500.0, 120.0, new DateOnly(2021, 12, 12), 180.0, 75f }, + { 2, 600.0, 130.0, new DateOnly(2021, 1, 11), 190.0, 60f }, + { 3, 550.0, 125.0, new DateOnly(2022, 12, 30), 185.0, 68f }, + { 4, 650.0, 135.0, new DateOnly(2023, 2, 20), 195.0, 58f }, + { 5, 450.0, 110.0, new DateOnly(2024, 1, 10), 170.0, 90f } }); migrationBuilder.InsertData( @@ -222,11 +222,11 @@ namespace StubbedContextLib.Migrations columns: new[] { "IdTraining", "Date", "Description", "FeedBack", "Latitude", "Longitude" }, values: new object[,] { - { 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Running", "Good", 48.8566f, 2.3522f }, - { 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cycling", null, 48.8566f, 2.3522f }, - { 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Good", 48.8566f, 2.3522f }, - { 4, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Running", "Good", 48.8566f, 2.3522f }, - { 5, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Cycling", null, 48.8566f, 2.3522f } + { 1, new DateOnly(2024, 1, 19), "Running", "Good", 48.8566f, 2.3522f }, + { 2, new DateOnly(2024, 2, 20), "Cycling", null, 48.8566f, 2.3522f }, + { 3, new DateOnly(2024, 2, 21), null, "Good", 48.8566f, 2.3522f }, + { 4, new DateOnly(2024, 2, 22), "Running", "Good", 48.8566f, 2.3522f }, + { 5, new DateOnly(2024, 2, 23), "Cycling", null, 48.8566f, 2.3522f } }); } diff --git a/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs b/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs index 69783d1..b1ab193 100644 --- a/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs +++ b/src/StubbedContextLib/Migrations/TrainingStubbedContextModelSnapshot.cs @@ -29,13 +29,13 @@ namespace StubbedContextLib.Migrations b.Property("AverageTemperature") .HasColumnType("REAL"); - b.Property("Date") + b.Property("Date") .HasColumnType("TEXT"); b.Property("EffortFelt") .HasColumnType("INTEGER"); - b.Property("EndTime") + b.Property("EndTime") .HasColumnType("TEXT"); b.Property("HasAutoPause") @@ -50,7 +50,7 @@ namespace StubbedContextLib.Migrations b.Property("StandardDeviation") .HasColumnType("REAL"); - b.Property("StartTime") + b.Property("StartTime") .HasColumnType("TEXT"); b.Property("Type") @@ -74,14 +74,14 @@ namespace StubbedContextLib.Migrations IdActivity = 1, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 1, 10), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(14, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 0, 34), Type = "Running", Variability = 0.5f, Variance = 0.5f @@ -91,14 +91,14 @@ namespace StubbedContextLib.Migrations IdActivity = 2, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 1, 25), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(14, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 4, 34), Type = "Cycling", Variability = 0.5f, Variance = 0.5f @@ -108,14 +108,14 @@ namespace StubbedContextLib.Migrations IdActivity = 3, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 12, 10), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(15, 2, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 30, 34), Type = "Swimming", Variability = 0.5f, Variance = 0.5f @@ -125,14 +125,14 @@ namespace StubbedContextLib.Migrations IdActivity = 4, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 2), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(16, 1, 55), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(15, 0, 0), Type = "Walking", Variability = 0.5f, Variance = 0.5f @@ -142,14 +142,14 @@ namespace StubbedContextLib.Migrations IdActivity = 5, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 12), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(9, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(7, 45, 34), Type = "Hiking", Variability = 0.5f, Variance = 0.5f @@ -159,14 +159,14 @@ namespace StubbedContextLib.Migrations IdActivity = 6, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 27), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(14, 0, 22), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(13, 30, 1), Type = "Climbing", Variability = 0.5f, Variance = 0.5f @@ -176,14 +176,14 @@ namespace StubbedContextLib.Migrations IdActivity = 7, Average = 0.5f, AverageTemperature = 20f, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 22), EffortFelt = 5, - EndTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + EndTime = new TimeOnly(23, 50, 58), HasAutoPause = false, Maximum = 0, Minimum = 0, StandardDeviation = 0.5f, - StartTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + StartTime = new TimeOnly(22, 0, 34), Type = "Yoga", Variability = 0.5f, Variance = 0.5f @@ -196,7 +196,7 @@ namespace StubbedContextLib.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("DateOfBirth") + b.Property("DateOfBirth") .HasColumnType("TEXT"); b.Property("Email") @@ -245,7 +245,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 1, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1990, 1, 1), Email = "john.doe@example.com", FirstName = "John", IsCoach = true, @@ -259,8 +259,8 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 2, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - Email = "jane.smith@example.com", + DateOfBirth = new DateOnly(1995, 1, 1), + Email = "jane.smith@exemple.com", FirstName = "Jane", IsCoach = false, LastName = "Smith", @@ -273,7 +273,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 3, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1992, 1, 1), Email = "paul.martin@example.com", FirstName = "Paul", IsCoach = true, @@ -287,7 +287,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 4, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1993, 1, 1), Email = "anna.brown@example.com", FirstName = "Anna", IsCoach = false, @@ -301,7 +301,7 @@ namespace StubbedContextLib.Migrations new { IdAthlete = 5, - DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + DateOfBirth = new DateOnly(1991, 1, 1), Email = "bruce.lee@example.com", FirstName = "Bruce", IsCoach = false, @@ -396,7 +396,7 @@ namespace StubbedContextLib.Migrations b.Property("Temperature") .HasColumnType("REAL"); - b.Property("Time") + b.Property("Time") .HasColumnType("TEXT"); b.HasKey("IdHeartRate"); @@ -412,7 +412,7 @@ namespace StubbedContextLib.Migrations Latitude = 66f, Longitude = 35f, Temperature = 20f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 30) }, new { @@ -422,7 +422,7 @@ namespace StubbedContextLib.Migrations Latitude = 67f, Longitude = 35f, Temperature = 20.5f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 31) }, new { @@ -432,7 +432,7 @@ namespace StubbedContextLib.Migrations Latitude = 66f, Longitude = 36f, Temperature = 20f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 32) }, new { @@ -442,7 +442,7 @@ namespace StubbedContextLib.Migrations Latitude = 67f, Longitude = 36f, Temperature = 20.5f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 33) }, new { @@ -452,7 +452,7 @@ namespace StubbedContextLib.Migrations Latitude = 66f, Longitude = 37f, Temperature = 20f, - Time = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + Time = new TimeOnly(13, 0, 34) }); }); @@ -486,7 +486,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 1, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2023, 12, 25, 13, 0, 40, 0, DateTimeKind.Unspecified), Message = "You have a new activity to check", Statut = true, Urgence = "A" @@ -494,7 +494,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 2, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2023, 12, 26, 13, 10, 40, 0, DateTimeKind.Unspecified), Message = "You have a new athlete to check", Statut = false, Urgence = "3" @@ -502,7 +502,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 3, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2023, 12, 26, 16, 10, 4, 0, DateTimeKind.Unspecified), Message = "You have a new heart rate to check", Statut = true, Urgence = "2" @@ -510,7 +510,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 4, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2024, 1, 12, 9, 30, 50, 0, DateTimeKind.Unspecified), Message = "You have a new data source to check", Statut = false, Urgence = "1" @@ -518,7 +518,7 @@ namespace StubbedContextLib.Migrations new { IdNotif = 5, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateTime(2024, 2, 22, 12, 10, 0, 0, DateTimeKind.Unspecified), Message = "You have a new notification to check", Statut = true, Urgence = "3" @@ -537,7 +537,7 @@ namespace StubbedContextLib.Migrations b.Property("AverageHeartRate") .HasColumnType("REAL"); - b.Property("Date") + b.Property("Date") .HasColumnType("TEXT"); b.Property("MaximumHeartRate") @@ -556,7 +556,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 1, AverageCaloriesBurned = 500.0, AverageHeartRate = 120.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2021, 12, 12), MaximumHeartRate = 180.0, Weight = 75f }, @@ -565,7 +565,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 2, AverageCaloriesBurned = 600.0, AverageHeartRate = 130.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2021, 1, 11), MaximumHeartRate = 190.0, Weight = 60f }, @@ -574,7 +574,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 3, AverageCaloriesBurned = 550.0, AverageHeartRate = 125.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2022, 12, 30), MaximumHeartRate = 185.0, Weight = 68f }, @@ -583,7 +583,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 4, AverageCaloriesBurned = 650.0, AverageHeartRate = 135.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2023, 2, 20), MaximumHeartRate = 195.0, Weight = 58f }, @@ -592,7 +592,7 @@ namespace StubbedContextLib.Migrations IdStatistic = 5, AverageCaloriesBurned = 450.0, AverageHeartRate = 110.0, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 10), MaximumHeartRate = 170.0, Weight = 90f }); @@ -604,7 +604,7 @@ namespace StubbedContextLib.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("Date") + b.Property("Date") .HasColumnType("TEXT"); b.Property("Description") @@ -629,7 +629,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 1, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 1, 19), Description = "Running", FeedBack = "Good", Latitude = 48.8566f, @@ -638,7 +638,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 2, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 20), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f @@ -646,7 +646,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 3, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 21), FeedBack = "Good", Latitude = 48.8566f, Longitude = 2.3522f @@ -654,7 +654,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 4, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 22), Description = "Running", FeedBack = "Good", Latitude = 48.8566f, @@ -663,7 +663,7 @@ namespace StubbedContextLib.Migrations new { IdTraining = 5, - Date = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + Date = new DateOnly(2024, 2, 23), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f diff --git a/src/StubbedContextLib/NotificationStubbedContext.cs b/src/StubbedContextLib/NotificationStubbedContext.cs index 84e5275..6af02f2 100644 --- a/src/StubbedContextLib/NotificationStubbedContext.cs +++ b/src/StubbedContextLib/NotificationStubbedContext.cs @@ -19,11 +19,11 @@ public class NotificationStubbedContext : HeartRateStubbedContext base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new NotificationEntity { IdNotif = 1, Message = "You have a new activity to check", Date = new DateTime(), Statut = true, Urgence = "A" }, - new NotificationEntity { IdNotif = 2, Message = "You have a new athlete to check", Date = new DateTime(), Statut = false, Urgence = "3" }, - new NotificationEntity { IdNotif = 3, Message = "You have a new heart rate to check", Date = new DateTime(), Statut = true, Urgence = "2" }, - new NotificationEntity { IdNotif = 4, Message = "You have a new data source to check", Date = new DateTime(), Statut = false, Urgence = "1" }, - new NotificationEntity { IdNotif = 5, Message = "You have a new notification to check", Date = new DateTime(), Statut = true, Urgence = "3" } + new NotificationEntity { IdNotif = 1, Message = "You have a new activity to check", Date = new DateTime(2023, 12, 25, 13, 00, 40), Statut = true, Urgence = "A" }, + new NotificationEntity { IdNotif = 2, Message = "You have a new athlete to check", Date = new DateTime(2023, 12, 26, 13, 10, 40), Statut = false, Urgence = "3" }, + new NotificationEntity { IdNotif = 3, Message = "You have a new heart rate to check", Date = new DateTime(2023, 12, 26, 16, 10, 04), Statut = true, Urgence = "2" }, + new NotificationEntity { IdNotif = 4, Message = "You have a new data source to check", Date = new DateTime(2024, 01, 12, 09, 30, 50), Statut = false, Urgence = "1" }, + new NotificationEntity { IdNotif = 5, Message = "You have a new notification to check", Date = new DateTime(2024, 02, 22, 12, 10, 00), Statut = true, Urgence = "3" } ); } } \ No newline at end of file diff --git a/src/StubbedContextLib/StatisticStubbedContext.cs b/src/StubbedContextLib/StatisticStubbedContext.cs index cc5cf1e..d7ffc4b 100644 --- a/src/StubbedContextLib/StatisticStubbedContext.cs +++ b/src/StubbedContextLib/StatisticStubbedContext.cs @@ -19,11 +19,11 @@ public class StatisticStubbedContext : NotificationStubbedContext base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new StatisticEntity { IdStatistic = 1, Weight = 75, AverageHeartRate = 120, MaximumHeartRate = 180, AverageCaloriesBurned = 500, Date = new DateTime(12/12/2021) }, - new StatisticEntity { IdStatistic = 2, Weight = 60, AverageHeartRate = 130, MaximumHeartRate = 190, AverageCaloriesBurned = 600, Date = new DateTime(11/01/2021) }, - new StatisticEntity { IdStatistic = 3, Weight = 68, AverageHeartRate = 125, MaximumHeartRate = 185, AverageCaloriesBurned = 550, Date = new DateTime(30/12/2022) }, - new StatisticEntity { IdStatistic = 4, Weight = 58, AverageHeartRate = 135, MaximumHeartRate = 195, AverageCaloriesBurned = 650, Date = new DateTime(20/02/2023) }, - new StatisticEntity { IdStatistic = 5, Weight = 90, AverageHeartRate = 110, MaximumHeartRate = 170, AverageCaloriesBurned = 450, Date = new DateTime(10/01/2024) } + new StatisticEntity { IdStatistic = 1, Weight = 75, AverageHeartRate = 120, MaximumHeartRate = 180, AverageCaloriesBurned = 500, Date = new DateOnly(2021, 12, 12) }, + new StatisticEntity { IdStatistic = 2, Weight = 60, AverageHeartRate = 130, MaximumHeartRate = 190, AverageCaloriesBurned = 600, Date = new DateOnly(2021, 01, 11) }, + new StatisticEntity { IdStatistic = 3, Weight = 68, AverageHeartRate = 125, MaximumHeartRate = 185, AverageCaloriesBurned = 550, Date = new DateOnly(2022, 12, 30) }, + new StatisticEntity { IdStatistic = 4, Weight = 58, AverageHeartRate = 135, MaximumHeartRate = 195, AverageCaloriesBurned = 650, Date = new DateOnly(2023, 02, 20) }, + new StatisticEntity { IdStatistic = 5, Weight = 90, AverageHeartRate = 110, MaximumHeartRate = 170, AverageCaloriesBurned = 450, Date = new DateOnly(2024, 01, 10) } ); } } \ No newline at end of file diff --git a/src/StubbedContextLib/TrainingStubbedContext.cs b/src/StubbedContextLib/TrainingStubbedContext.cs index 4f8d404..b62df0e 100644 --- a/src/StubbedContextLib/TrainingStubbedContext.cs +++ b/src/StubbedContextLib/TrainingStubbedContext.cs @@ -19,11 +19,11 @@ public class TrainingStubbedContext : StatisticStubbedContext base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasData( - new TrainingEntity { IdTraining = 1, Date = new DateTime(19/02/2024), Description = "Running", Latitude = 48.8566f, Longitude = 2.3522f, FeedBack = "Good" }, - new TrainingEntity { IdTraining = 2, Date = new DateTime(20/02/2024), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f }, - new TrainingEntity { IdTraining = 3, Date = new DateTime(21/02/2024), Latitude = 48.8566f, Longitude = 2.3522f, FeedBack = "Good" }, - new TrainingEntity { IdTraining = 4, Date = new DateTime(22/02/2024), Description = "Running", Latitude = 48.8566f, Longitude = 2.3522f, FeedBack = "Good" }, - new TrainingEntity { IdTraining = 5, Date = new DateTime(23/02/2024), Description = "Cycling", Latitude = 48.8566f, Longitude = 2.3522f } + 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 } ); } } \ No newline at end of file diff --git a/src/Tests/ConsoleTestEntities/Program.cs b/src/Tests/ConsoleTestEntities/Program.cs index 9e2af13..e241e05 100644 --- a/src/Tests/ConsoleTestEntities/Program.cs +++ b/src/Tests/ConsoleTestEntities/Program.cs @@ -120,7 +120,7 @@ class Program // ! A revoir !! Console.WriteLine("Accès à l'athlete de date de naissance '01/01/2000' :"); Console.WriteLine("---------------------------------"); - foreach (var athlete in db.AthletesSet.Where(a => a.DateOfBirth == new DateTime())) + foreach (var athlete in db.AthletesSet.Where(a => a.DateOfBirth == new DateOnly())) { Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}"); } @@ -201,7 +201,7 @@ class Program Console.WriteLine("Accès à l'activité de date '01/01/2022' :"); Console.WriteLine("---------------------------------"); - foreach (var activity in db.ActivitiesSet.Where(a => a.Date == new DateTime(01/01/2022))) + foreach (var activity in db.ActivitiesSet.Where(a => a.Date == new DateOnly(2000,01, 01))) { Console.WriteLine($"\t{activity.IdActivity} - {activity.Type}, {activity.Date}, {activity.StartTime}, {activity.EndTime}, {activity.EffortFelt}, {activity.Variability}, {activity.Variance}, {activity.StandardDeviation}, {activity.Average}, {activity.Maximum}, {activity.Minimum}, {activity.AverageTemperature}, {activity.HasAutoPause}"); } @@ -211,7 +211,7 @@ class Program Console.WriteLine("Accès à l'activité de date '01/01/2022' et de type 'Running' :"); Console.WriteLine("---------------------------------"); - foreach (var activity in db.ActivitiesSet.Where(a => a.Date == new DateTime(01/01/2022) && a.Type == "Running")) + foreach (var activity in db.ActivitiesSet.Where(a => a.Date == new DateOnly(2022, 01, 01) && a.Type == "Running")) { Console.WriteLine($"\t{activity.IdActivity} - {activity.Type}, {activity.Date}, {activity.StartTime}, {activity.EndTime}, {activity.EffortFelt}, {activity.Variability}, {activity.Variance}, {activity.StandardDeviation}, {activity.Average}, {activity.Maximum}, {activity.Minimum}, {activity.AverageTemperature}, {activity.HasAutoPause}"); } @@ -366,10 +366,10 @@ class Program static void AddUpdateDeleteAthlete(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des athletes :"); // Ajout d'un nouveau livre - var newAthlete = new AthleteEntity { Username = "Doe", LastName = "Doe", FirstName = "John", Email = "essaie.example.com", Password = "TheNewPassword", Sexe = "M", Lenght = 1.80, Weight = 90, DateOfBirth = new DateTime(2000, 01, 01), IsCoach = false }; + var newAthlete = new AthleteEntity { Username = "Doe", LastName = "Doe", FirstName = "John", Email = "essaie.example.com", Password = "TheNewPassword", Sexe = "M", Lenght = 1.80, Weight = 90, DateOfBirth = new DateOnly(2024, 02, 22), IsCoach = false }; db.AthletesSet.Add(newAthlete); db.SaveChanges(); @@ -405,9 +405,9 @@ class Program static void AddUpdateDeleteActivity(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des activités :"); - var newActivity = new ActivityEntity { Type = "Running", Date = new DateTime(2022, 01, 01), StartTime = new DateTime(2022, 01, 01, 12, 00, 00), EndTime = new DateTime(2022, 01, 01, 13, 00, 00), EffortFelt = 5, Variability = 10, Variance = 20, StandardDeviation = 30, Average = 40, Maximum = 50, Minimum = 60, AverageTemperature = 70, HasAutoPause = false }; + var newActivity = new ActivityEntity { Type = "Running", Date = new DateOnly(2022, 02, 22), StartTime = new TimeOnly(12, 01, 38), EndTime = new TimeOnly(13, 45, 58), EffortFelt = 5, Variability = 10, Variance = 20, StandardDeviation = 30, Average = 40, Maximum = 50, Minimum = 60, AverageTemperature = 70, HasAutoPause = false }; db.ActivitiesSet.Add(newActivity); db.SaveChanges(); @@ -439,7 +439,7 @@ class Program static void AddUpdateDeleteDataSource(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des sources de données :"); var newDataSource = new DataSourceEntity { Type = "Polar", Modele = "Polar Vantage V2", Precision = 0.5F }; db.DataSourcesSet.Add(newDataSource); @@ -472,9 +472,9 @@ class Program static void AddUpdateDeleteHeartRate(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des fréquences cardiaques :"); - var newHeartRate = new HeartRateEntity { Altitude = 100, Time = new DateTime(2022, 01, 01, 12, 00, 00), Temperature = 20, Bpm = 150, Longitude = 0, Latitude = 0 }; + var newHeartRate = new HeartRateEntity { Altitude = 100, Time = new TimeOnly(12, 00, 00), Temperature = 20, Bpm = 150, Longitude = 0, Latitude = 0 }; db.HeartRatesSet.Add(newHeartRate); db.SaveChanges(); @@ -505,7 +505,7 @@ class Program static void AddUpdateDeleteNotification(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des notifications :"); var newNotification = new NotificationEntity { Message = "Message de test", Date = new DateTime(2022, 01, 01), Statut = false, Urgence = "Urgent" }; db.NotificationsSet.Add(newNotification); @@ -538,9 +538,9 @@ class Program static void AddUpdateDeleteStatistic(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des statistiques :"); - var newStatistic = new StatisticEntity { Weight = 80, AverageHeartRate = 150, MaximumHeartRate = 180, AverageCaloriesBurned = 500, Date = new DateTime(2022, 01, 01) }; + var newStatistic = new StatisticEntity { Weight = 80, AverageHeartRate = 150, MaximumHeartRate = 180, AverageCaloriesBurned = 500, Date = new DateOnly(2022, 01, 01) }; db.StatisticsSet.Add(newStatistic); db.SaveChanges(); @@ -571,9 +571,9 @@ class Program static void AddUpdateDeleteTraining(LibraryContext db) { - Console.WriteLine("Test d'ajout, de modification et de suppression :"); + Console.WriteLine("Test d'ajout, de modification et de suppression des entrainements :"); - var newTraining = new TrainingEntity { Date = new DateTime(2022, 01, 01), Description = "Entrainement de test", Latitude = 0, Longitude = 0, FeedBack = "Bon entrainement" }; + var newTraining = new TrainingEntity { Date = new DateOnly(2022, 01, 01), Description = "Entrainement de test", Latitude = 0, Longitude = 0, FeedBack = "Bon entrainement" }; db.TrainingsSet.Add(newTraining); db.SaveChanges(); diff --git a/src/Tests/ConsoleTestEntities/uca.HeartTrack.db b/src/Tests/ConsoleTestEntities/uca.HeartTrack.db index fa4e4d2ad3ea393d1194cebf2211e60648ca5b99..25234ed7daad078958a78f27fdfe71ac542fc053 100644 GIT binary patch delta 1396 zcmZ9MPfQb89LL|A($0wOJlJ+puv8e)O<8F2-kTYqqaw9tg%H$*#AVHfii+LILP@m# zAyKI&M&pIUB$^nnCdL>MaZS8<&km%$FjT+WDE+5%oIH5 zf@8mg32Lq9hMYg^D8^}@FlU%Fw?Xl-27GIqK)0 z9*;DsRYX3MH&DeLQY8*lFhLfQQW{H&f>yfQ3Z4DwU z!*)l5urX*>p*IMP>?~-Z8niXY^2EWN``e@%)EIG5=~e^iYFChSN>i2rjm`_ z?*L!Sl^5v`ehh}lJ76_ou`PFau_q2;Z8?;3VkUi)cdMQmn#@iIelDIoy zMlJ^WqI&rFhPx1XPac5TanhxJ0mC2ErUAX6C?HpJ>b`s2y*C4P^^`0li2HvjMsS}7 zhi30L-&;FBD7`zh`>pk$2mFhZ+WJZEjx42eyTHAU>f>xPdT?&;R0eAKUdUZuYKiyY M@7@YUvcdE-iyDf}pFe%0Aw+4;|Zkk$5;~jEDd8d!Ofjp7YGD zadT_jKR1^MFhm zn5UN@V4*KC;+5qHGLb5mGGeJA^>bs9domqRULw;quJ}&VYFXS=21BJ`yUyzYnG>>9Q(hJ=4cWA?|mwFLA1dsGnT9A4T>vYh+88S{9 zji$rE9jv^!SwEXym8e>mNQxpXwaP_-#hBwb(vRlR6Z|8=Uo5zhV=W<1H8h37p75#2B||=(QEEHLt@p%AV)5t z=iHtI1zon$ja