diff --git a/src/DbContextLib/DbContextLib.csproj b/src/DbContextLib/DbContextLib.csproj
new file mode 100644
index 0000000..928ae7a
--- /dev/null
+++ b/src/DbContextLib/DbContextLib.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/DbContextLib/LibraryContext.cs b/src/DbContextLib/LibraryContext.cs
new file mode 100644
index 0000000..008bbc9
--- /dev/null
+++ b/src/DbContextLib/LibraryContext.cs
@@ -0,0 +1,30 @@
+using Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace DbContextLib;
+
+public class LibraryContext : DbContext
+{
+ public DbSet AthletesSet { get; set; }
+
+ public LibraryContext()
+ :base()
+ { }
+
+ public LibraryContext(DbContextOptions options)
+ :base(options)
+ { }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if(!optionsBuilder.IsConfigured)
+ {
+ optionsBuilder.UseSqlite($"Data Source=uca.HeartTrack.db");
+ }
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+ }
+}
diff --git a/src/Entities/ActivityEntity.cs b/src/Entities/ActivityEntity.cs
new file mode 100644
index 0000000..62b0870
--- /dev/null
+++ b/src/Entities/ActivityEntity.cs
@@ -0,0 +1,26 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+
+[Table("Activity")]
+public class ActivityEntity
+{
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdActivity { get; set; }
+ public required string Type { get; set; }
+ public DateTime Date { get; set; }
+ public DateTime StartTime { get; set; }
+ public DateTime EndTime { get; set; }
+ public int EffortFelt { get; set; }
+ public float Variability { get; set; }
+ public float Variance { get; set; }
+ public float StandardDeviation { get; set; }
+ public float Average { get; set; }
+ public int Maximum { get; set; }
+ public int Minimum { get; set; }
+ public float AverageTemperature { get; set; }
+ public bool HasAutoPause { get; set; }
+}
\ No newline at end of file
diff --git a/src/Entities/AthleteEntity.cs b/src/Entities/AthleteEntity.cs
new file mode 100644
index 0000000..a9fff57
--- /dev/null
+++ b/src/Entities/AthleteEntity.cs
@@ -0,0 +1,27 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+[Table("Athlete")]
+public class AthleteEntity
+{
+ // ! donner plus de contraintes !!
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdAthlete { get; set; }
+ [Required]
+ [MaxLength(100)]
+ public required string Username { get; set; }
+ [MaxLength(100)]
+ public required string LastName { get; set; }
+ [MaxLength(150)]
+ public required string FirstName { get; set; }
+ public required string Email { get; set; }
+ public required string Sexe { get; set; }
+ public float Lenght { get; set; }
+ public float Weight { get; set; }
+ public required string Password { get; set; }
+ public DateTime DateOfBirth { get; set; }
+ public bool IsCoach { get; set; }
+}
\ No newline at end of file
diff --git a/src/Entities/DataSourceEntity.cs b/src/Entities/DataSourceEntity.cs
new file mode 100644
index 0000000..8bed224
--- /dev/null
+++ b/src/Entities/DataSourceEntity.cs
@@ -0,0 +1,15 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+[Table("DataSource")]
+public class DataSourceEntity
+{
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdSource { get; set; }
+ public required string Type { get; set; }
+ public required string Modele { get; set; }
+ public float Precision { get; set; }
+}
\ No newline at end of file
diff --git a/src/Entities/Entities.csproj b/src/Entities/Entities.csproj
new file mode 100644
index 0000000..bb23fb7
--- /dev/null
+++ b/src/Entities/Entities.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/src/Entities/HeartRateEntity.cs b/src/Entities/HeartRateEntity.cs
new file mode 100644
index 0000000..0806219
--- /dev/null
+++ b/src/Entities/HeartRateEntity.cs
@@ -0,0 +1,18 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+[Table("HeartRate")]
+public class HeartRateEntity
+{
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdHeartRate { get; set; }
+ public double Altitude { get; set; }
+ public DateTime Time { get; set; }
+ public float Temperature { get; set; }
+ public int Bpm { get; set; }
+ public float Longitude { get; set; }
+ public float Latitude { get; set; }
+}
\ No newline at end of file
diff --git a/src/Entities/NotificationEntity.cs b/src/Entities/NotificationEntity.cs
new file mode 100644
index 0000000..53d12cc
--- /dev/null
+++ b/src/Entities/NotificationEntity.cs
@@ -0,0 +1,16 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+[Table("Notification")]
+public class NotificationEntity
+{
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdNotif { get; set; }
+ public required string Message { get; set; }
+ public DateTime Date { get; set; }
+ public required bool Statut { get; set; }
+ public required string Urgence { get; set; }
+}
\ No newline at end of file
diff --git a/src/Entities/StatisticEntity.cs b/src/Entities/StatisticEntity.cs
new file mode 100644
index 0000000..ed01553
--- /dev/null
+++ b/src/Entities/StatisticEntity.cs
@@ -0,0 +1,17 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+[Table("Statistic")]
+public class StatisticEntity
+{
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdStatistic { get; set; }
+ public float Weight { get; set; }
+ public double AverageHeartRate { get; set; }
+ public double MaximumHeartRate { get; set; }
+ public double AverageCaloriesBurned { get; set; }
+ public DateTime Date { get; set; }
+}
\ No newline at end of file
diff --git a/src/Entities/TrainingEntity.cs b/src/Entities/TrainingEntity.cs
new file mode 100644
index 0000000..5bf7949
--- /dev/null
+++ b/src/Entities/TrainingEntity.cs
@@ -0,0 +1,20 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Entities;
+
+[Table("Training")]
+public class TrainingEntity
+{
+ // ! donner plus de contraintes !!
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int IdTraining { get; set; }
+ public DateTime Date { get; set; }
+ [MaxLength(300)]
+ public string? Description { get; set; }
+ public float Latitude { get; set; }
+ public float Longitude { get; set; }
+ [MaxLength(300)]
+ public string? FeedBack { get; set; }
+}
\ No newline at end of file
diff --git a/src/HeartTrack.sln b/src/HeartTrack.sln
new file mode 100644
index 0000000..6ecaf7b
--- /dev/null
+++ b/src/HeartTrack.sln
@@ -0,0 +1,52 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbContextLib", "DbContextLib\DbContextLib.csproj", "{330A5DA0-0B4E-48D4-9AF3-6DCB39EE9622}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Entities", "Entities\Entities.csproj", "{A07F86B3-555B-4B35-8BB1-25E844825A38}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StubbedContextLib", "StubbedContextLib\StubbedContextLib.csproj", "{2F44DE6E-EFFC-42FE-AFF6-79CDC762E6D8}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2B227C67-3BEC-4A83-BDA0-F3918FBC0D18}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTestEntities", "Tests\ConsoleTestEntities\ConsoleTestEntities.csproj", "{477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleTestRelationships", "Tests\ConsoleTestRelationships\ConsoleTestRelationships.csproj", "{2D166FAD-4934-474B-96A8-6C0635156EC2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {330A5DA0-0B4E-48D4-9AF3-6DCB39EE9622}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {330A5DA0-0B4E-48D4-9AF3-6DCB39EE9622}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {330A5DA0-0B4E-48D4-9AF3-6DCB39EE9622}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {330A5DA0-0B4E-48D4-9AF3-6DCB39EE9622}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A07F86B3-555B-4B35-8BB1-25E844825A38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A07F86B3-555B-4B35-8BB1-25E844825A38}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A07F86B3-555B-4B35-8BB1-25E844825A38}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A07F86B3-555B-4B35-8BB1-25E844825A38}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2F44DE6E-EFFC-42FE-AFF6-79CDC762E6D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2F44DE6E-EFFC-42FE-AFF6-79CDC762E6D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2F44DE6E-EFFC-42FE-AFF6-79CDC762E6D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2F44DE6E-EFFC-42FE-AFF6-79CDC762E6D8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2D166FAD-4934-474B-96A8-6C0635156EC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2D166FAD-4934-474B-96A8-6C0635156EC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2D166FAD-4934-474B-96A8-6C0635156EC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2D166FAD-4934-474B-96A8-6C0635156EC2}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {477D2129-A6C9-4FF8-8BE9-5E9E8E5282F8} = {2B227C67-3BEC-4A83-BDA0-F3918FBC0D18}
+ {2D166FAD-4934-474B-96A8-6C0635156EC2} = {2B227C67-3BEC-4A83-BDA0-F3918FBC0D18}
+ EndGlobalSection
+EndGlobal
diff --git a/src/StubbedContextLib/ActivityStubbedContext.cs b/src/StubbedContextLib/ActivityStubbedContext.cs
new file mode 100644
index 0000000..11f8457
--- /dev/null
+++ b/src/StubbedContextLib/ActivityStubbedContext.cs
@@ -0,0 +1,31 @@
+using DbContextLib;
+using Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace StubbedContextLib;
+
+public class ActivityStubbedContext : LibraryContext
+{
+ public ActivityStubbedContext()
+ :base()
+ { }
+
+ public ActivityStubbedContext(DbContextOptions options)
+ :base(options)
+ { }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ 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 }
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/StubbedContextLib/AthleteStubbedContext.cs b/src/StubbedContextLib/AthleteStubbedContext.cs
new file mode 100644
index 0000000..c4a238b
--- /dev/null
+++ b/src/StubbedContextLib/AthleteStubbedContext.cs
@@ -0,0 +1,29 @@
+using DbContextLib;
+using Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace StubbedContextLib;
+
+public class AthleteStubbedContext : LibraryContext
+{
+ public AthleteStubbedContext()
+ :base()
+ { }
+
+ public AthleteStubbedContext(DbContextOptions options)
+ :base(options)
+ { }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ 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 }
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/StubbedContextLib/DataSourceStubbedContext.cs b/src/StubbedContextLib/DataSourceStubbedContext.cs
new file mode 100644
index 0000000..f1b8b2b
--- /dev/null
+++ b/src/StubbedContextLib/DataSourceStubbedContext.cs
@@ -0,0 +1,29 @@
+using DbContextLib;
+using Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace StubbedContextLib;
+
+public class DataSourceStubbedContext : LibraryContext
+{
+ public DataSourceStubbedContext()
+ :base()
+ { }
+
+ public DataSourceStubbedContext(DbContextOptions options)
+ :base(options)
+ { }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ modelBuilder.Entity().HasData(
+ new DataSourceEntity { IdSource = 1, Type = "Smartwatch", Modele = "Garmin", Precision = 0.5f },
+ new DataSourceEntity { IdSource = 2, Type = "Smartwatch", Modele = "Polar", Precision = 0.5f },
+ new DataSourceEntity { IdSource = 3, Type = "Smartwatch", Modele = "Suunto", Precision = 0.5f },
+ new DataSourceEntity { IdSource = 4, Type = "Smartwatch", Modele = "Fitbit", Precision = 0.5f },
+ new DataSourceEntity { IdSource = 5, Type = "Smartwatch", Modele = "Apple Watch", Precision = 0.5f }
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/StubbedContextLib/HeartRateStubbedContext.cs b/src/StubbedContextLib/HeartRateStubbedContext.cs
new file mode 100644
index 0000000..f22659a
--- /dev/null
+++ b/src/StubbedContextLib/HeartRateStubbedContext.cs
@@ -0,0 +1,29 @@
+using DbContextLib;
+using Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace StubbedContextLib;
+
+public class HeartRateStubbedContext : LibraryContext
+{
+ public HeartRateStubbedContext()
+ :base()
+ { }
+
+ public HeartRateStubbedContext(DbContextOptions options)
+ :base(options)
+ { }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ 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 }
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/StubbedContextLib/Migrations/20240216134447_MyMirgations.Designer.cs b/src/StubbedContextLib/Migrations/20240216134447_MyMirgations.Designer.cs
new file mode 100644
index 0000000..4232a95
--- /dev/null
+++ b/src/StubbedContextLib/Migrations/20240216134447_MyMirgations.Designer.cs
@@ -0,0 +1,147 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using StubbedContextLib;
+
+#nullable disable
+
+namespace StubbedContextLib.Migrations
+{
+ [DbContext(typeof(AthleteStubbedContext))]
+ [Migration("20240216134447_MyMirgations")]
+ partial class MyMirgations
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
+
+ modelBuilder.Entity("Entities.AthleteEntity", b =>
+ {
+ b.Property("IdAthlete")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("DateOfBirth")
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(150)
+ .HasColumnType("TEXT");
+
+ b.Property("IsCoach")
+ .HasColumnType("INTEGER");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("Lenght")
+ .HasColumnType("REAL");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Sexe")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("Weight")
+ .HasColumnType("REAL");
+
+ b.HasKey("IdAthlete");
+
+ b.ToTable("Athlete");
+
+ b.HasData(
+ new
+ {
+ IdAthlete = 1,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "john.doe@example.com",
+ FirstName = "John",
+ IsCoach = true,
+ LastName = "Doe",
+ Lenght = 1.8,
+ Password = "password123",
+ Sexe = "M",
+ Username = "Doe",
+ Weight = 75f
+ },
+ new
+ {
+ IdAthlete = 2,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "jane.smith@example.com",
+ FirstName = "Jane",
+ IsCoach = false,
+ LastName = "Smith",
+ Lenght = 1.6499999999999999,
+ Password = "secure456",
+ Sexe = "F",
+ Username = "Smith",
+ Weight = 60f
+ },
+ new
+ {
+ IdAthlete = 3,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "paul.martin@example.com",
+ FirstName = "Paul",
+ IsCoach = true,
+ LastName = "Martin",
+ Lenght = 1.75,
+ Password = "super789",
+ Sexe = "M",
+ Username = "Martin",
+ Weight = 68f
+ },
+ new
+ {
+ IdAthlete = 4,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "anna.brown@example.com",
+ FirstName = "Anna",
+ IsCoach = false,
+ LastName = "Brown",
+ Lenght = 1.7,
+ Password = "test000",
+ Sexe = "F",
+ Username = "Brown",
+ Weight = 58f
+ },
+ new
+ {
+ IdAthlete = 5,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "bruce.lee@example.com",
+ FirstName = "Bruce",
+ IsCoach = false,
+ LastName = "Lee",
+ Lenght = 2.0,
+ Password = "hello321",
+ Sexe = "M",
+ Username = "Lee",
+ Weight = 90f
+ });
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/StubbedContextLib/Migrations/20240216134447_MyMirgations.cs b/src/StubbedContextLib/Migrations/20240216134447_MyMirgations.cs
new file mode 100644
index 0000000..3f410d6
--- /dev/null
+++ b/src/StubbedContextLib/Migrations/20240216134447_MyMirgations.cs
@@ -0,0 +1,58 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
+
+namespace StubbedContextLib.Migrations
+{
+ ///
+ public partial class MyMirgations : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Athlete",
+ columns: table => new
+ {
+ IdAthlete = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Username = table.Column(type: "TEXT", maxLength: 100, nullable: false),
+ LastName = table.Column(type: "TEXT", maxLength: 100, nullable: false),
+ FirstName = table.Column(type: "TEXT", maxLength: 150, nullable: false),
+ Email = table.Column(type: "TEXT", nullable: false),
+ Sexe = table.Column(type: "TEXT", nullable: false),
+ 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),
+ IsCoach = table.Column(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Athlete", x => x.IdAthlete);
+ });
+
+ migrationBuilder.InsertData(
+ table: "Athlete",
+ 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 }
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Athlete");
+ }
+ }
+}
diff --git a/src/StubbedContextLib/Migrations/AthleteStubbedContextModelSnapshot.cs b/src/StubbedContextLib/Migrations/AthleteStubbedContextModelSnapshot.cs
new file mode 100644
index 0000000..1556ab4
--- /dev/null
+++ b/src/StubbedContextLib/Migrations/AthleteStubbedContextModelSnapshot.cs
@@ -0,0 +1,144 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using StubbedContextLib;
+
+#nullable disable
+
+namespace StubbedContextLib.Migrations
+{
+ [DbContext(typeof(AthleteStubbedContext))]
+ partial class AthleteStubbedContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
+
+ modelBuilder.Entity("Entities.AthleteEntity", b =>
+ {
+ b.Property("IdAthlete")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("DateOfBirth")
+ .HasColumnType("TEXT");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(150)
+ .HasColumnType("TEXT");
+
+ b.Property("IsCoach")
+ .HasColumnType("INTEGER");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("Lenght")
+ .HasColumnType("REAL");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Sexe")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT");
+
+ b.Property("Weight")
+ .HasColumnType("REAL");
+
+ b.HasKey("IdAthlete");
+
+ b.ToTable("Athlete");
+
+ b.HasData(
+ new
+ {
+ IdAthlete = 1,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "john.doe@example.com",
+ FirstName = "John",
+ IsCoach = true,
+ LastName = "Doe",
+ Lenght = 1.8,
+ Password = "password123",
+ Sexe = "M",
+ Username = "Doe",
+ Weight = 75f
+ },
+ new
+ {
+ IdAthlete = 2,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "jane.smith@example.com",
+ FirstName = "Jane",
+ IsCoach = false,
+ LastName = "Smith",
+ Lenght = 1.6499999999999999,
+ Password = "secure456",
+ Sexe = "F",
+ Username = "Smith",
+ Weight = 60f
+ },
+ new
+ {
+ IdAthlete = 3,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "paul.martin@example.com",
+ FirstName = "Paul",
+ IsCoach = true,
+ LastName = "Martin",
+ Lenght = 1.75,
+ Password = "super789",
+ Sexe = "M",
+ Username = "Martin",
+ Weight = 68f
+ },
+ new
+ {
+ IdAthlete = 4,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "anna.brown@example.com",
+ FirstName = "Anna",
+ IsCoach = false,
+ LastName = "Brown",
+ Lenght = 1.7,
+ Password = "test000",
+ Sexe = "F",
+ Username = "Brown",
+ Weight = 58f
+ },
+ new
+ {
+ IdAthlete = 5,
+ DateOfBirth = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+ Email = "bruce.lee@example.com",
+ FirstName = "Bruce",
+ IsCoach = false,
+ LastName = "Lee",
+ Lenght = 2.0,
+ Password = "hello321",
+ Sexe = "M",
+ Username = "Lee",
+ Weight = 90f
+ });
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/StubbedContextLib/NotificationStubbedContext.cs b/src/StubbedContextLib/NotificationStubbedContext.cs
new file mode 100644
index 0000000..e2b287a
--- /dev/null
+++ b/src/StubbedContextLib/NotificationStubbedContext.cs
@@ -0,0 +1,29 @@
+using DbContextLib;
+using Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace StubbedContextLib;
+
+public class NotificationStubbedContext : LibraryContext
+{
+ public NotificationStubbedContext()
+ :base()
+ { }
+
+ public NotificationStubbedContext(DbContextOptions options)
+ :base(options)
+ { }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ 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" }
+ );
+ }
+}
\ No newline at end of file
diff --git a/src/StubbedContextLib/StatisticStubbedContext.cs b/src/StubbedContextLib/StatisticStubbedContext.cs
new file mode 100644
index 0000000..e69de29
diff --git a/src/StubbedContextLib/StubbedContextLib.csproj b/src/StubbedContextLib/StubbedContextLib.csproj
new file mode 100644
index 0000000..ecea2c4
--- /dev/null
+++ b/src/StubbedContextLib/StubbedContextLib.csproj
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/src/StubbedContextLib/TrainingStubbedContext.cs b/src/StubbedContextLib/TrainingStubbedContext.cs
new file mode 100644
index 0000000..e69de29
diff --git a/src/Tests/ConsoleTestEntities/ConsoleTestEntities.csproj b/src/Tests/ConsoleTestEntities/ConsoleTestEntities.csproj
new file mode 100644
index 0000000..12b9a64
--- /dev/null
+++ b/src/Tests/ConsoleTestEntities/ConsoleTestEntities.csproj
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ $(MSBuildProjectDirectory)
+
+
+
diff --git a/src/Tests/ConsoleTestEntities/Program.cs b/src/Tests/ConsoleTestEntities/Program.cs
new file mode 100644
index 0000000..80154f8
--- /dev/null
+++ b/src/Tests/ConsoleTestEntities/Program.cs
@@ -0,0 +1,229 @@
+using DbContextLib;
+using StubbedContextLib;
+using Microsoft.EntityFrameworkCore;
+
+
+class Program
+{
+ static void Main(string[] args)
+ {
+
+ try {
+ using (LibraryContext db = new AthleteStubbedContext())
+ {
+ AthletesTests(db);
+
+ // // Test d'ajout, de modification et de suppression
+ // AddUpdateDeleteOperations(db);
+
+ // // Test d'emprunt et de retour de livre
+ // BorrowAndReturnBook(db);
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Une erreur s'est produite : {ex.Message}");
+ }
+ }
+
+
+ static void AthletesTests(LibraryContext db)
+ {
+ Console.WriteLine("Accès à tous les athletes :");
+
+ // Affichage des livres
+ Console.WriteLine("Athletes :");
+ Console.WriteLine("---------------------------------");
+
+ foreach (var athlete in db.AthletesSet)
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete d'id '2' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.IdAthlete == 2))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de username 'Doe' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.Username == "Doe"))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de sexe 'F' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.Sexe == "F"))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de email 'bruce.lee@example.com' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.Email == "bruce.lee@example.com"))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de poids '90' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.Weight == 90))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de taille '1.80' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.Lenght == 1.80))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ // ! 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()))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de nom 'Martin' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.LastName == "Martin"))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de prénom 'Anna' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.FirstName == "Anna"))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès à l'athlete de nom 'Brown' et de prénom 'Anna' :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.LastName == "Brown" && a.FirstName == "Anna"))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+
+ Console.WriteLine("Accès au coachs :");
+ Console.WriteLine("---------------------------------");
+ foreach (var athlete in db.AthletesSet.Where(a => a.IsCoach == true))
+ {
+ Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Lenght}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
+ }
+
+ Console.WriteLine("---------------------------------\n");
+ }
+
+// ///
+// /// Test d'ajout, de modification et de suppression de livres.
+// ///
+// /// Contexte de la base de données.
+// static void AddUpdateDeleteOperations(LibraryContext db)
+// {
+// Console.WriteLine("Test d'ajout, de modification et de suppression :");
+
+// // Ajout d'un nouveau livre
+// var newBook = new BookEntity { Title = "Comment bien réussir son stage", Author = "Abdelfettah HASBANI", Isbn = "TheBest" };
+// // par defaut, l'Id en long est égale à zero et se mettre par la BDD
+// db.BooksSet.Add(newBook);
+// db.SaveChanges();
+
+// // Affichage des livres après ajout
+// Console.WriteLine("Livres après ajout :");
+// // .Include pour importer les personnes, ne pas le mettre si pas besoins de personnes
+// foreach (var book in db.BooksSet.Include(b => b.Person))
+// {
+// Console.WriteLine($"\t{book.Id}, {book.Title}, {book.Author}, {book.Isbn}, {book.Person?.FirstName} {book.Person?.LastName}");
+// }
+
+// // Modification du titre du nouveau livre
+// newBook.Title = "Mes nouvelles dates de stage";
+// db.SaveChanges();
+
+// // Affichage des livres après modification
+// Console.WriteLine("Livres après modification :");
+// foreach (var book in db.BooksSet.Include(b => b.Person))
+// {
+// Console.WriteLine($"\t{book.Id}, {book.Title}, {book.Author}, {book.Isbn}, {book.Person?.FirstName} {book.Person?.LastName}");
+// }
+
+// // Suppression du nouveau livre
+// db.BooksSet.Remove(newBook);
+// db.SaveChanges();
+
+// // Affichage des livres après suppression
+// Console.WriteLine("Livres après suppression :");
+// foreach (var book in db.BooksSet.Include(b => b.Person))
+// {
+// Console.WriteLine($"\t{book.Id}, {book.Title}, {book.Author}, {book.Isbn}, {book.Person?.FirstName} {book.Person?.LastName}");
+// }
+// }
+
+// ///
+// /// Test d'emprunt et de retour de livre.
+// ///
+// /// Contexte de la base de données.
+// static void BorrowAndReturnBook(LibraryContext db)
+// {
+// Console.WriteLine("Test d'emprunt et de retour de livre :");
+// var person = db.PersonsSet.FirstOrDefault();
+// var bookToBorrow = db.BooksSet.FirstOrDefault();
+
+// // Retour du livre 1
+// if (bookToBorrow != null)
+// {
+// bookToBorrow.Person = null;
+// db.SaveChanges();
+// }
+
+// // Affichage des livres après retour
+// Console.WriteLine("Livres après retour :");
+// foreach (var book in db.BooksSet.Include(b => b.Person))
+// {
+// Console.WriteLine($"\t{book.Id}, {book.Title}, {book.Author}, {book.Isbn}, {book.Person?.FirstName} {book.Person?.LastName}");
+// }
+
+// // Emprunt d'un livre par une personne existante
+// if (person != null && bookToBorrow != null)
+// {
+// bookToBorrow.Person = person;
+// db.SaveChanges();
+// }
+
+// // Affichage des livres après emprunt
+// Console.WriteLine("Livres après emprunt :");
+// foreach (var book in db.BooksSet.Include(b => b.Person))
+// {
+// Console.WriteLine($"\t{book.Id}, {book.Title}, {book.Author}, {book.Isbn}, {book.Person?.FirstName} {book.Person?.LastName}");
+// }
+// }
+}
\ No newline at end of file
diff --git a/src/Tests/ConsoleTestEntities/uca.HeartTrack.db b/src/Tests/ConsoleTestEntities/uca.HeartTrack.db
new file mode 100644
index 0000000..1895d72
Binary files /dev/null and b/src/Tests/ConsoleTestEntities/uca.HeartTrack.db differ
diff --git a/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj b/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj
new file mode 100644
index 0000000..206b89a
--- /dev/null
+++ b/src/Tests/ConsoleTestRelationships/ConsoleTestRelationships.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
diff --git a/src/Tests/ConsoleTestRelationships/Program.cs b/src/Tests/ConsoleTestRelationships/Program.cs
new file mode 100644
index 0000000..83fa4f4
--- /dev/null
+++ b/src/Tests/ConsoleTestRelationships/Program.cs
@@ -0,0 +1,2 @@
+// See https://aka.ms/new-console-template for more information
+Console.WriteLine("Hello, World!");
diff --git a/src/Tests/TestStubEF/Program.cs b/src/Tests/TestStubEF/Program.cs
new file mode 100644
index 0000000..83fa4f4
--- /dev/null
+++ b/src/Tests/TestStubEF/Program.cs
@@ -0,0 +1,2 @@
+// See https://aka.ms/new-console-template for more information
+Console.WriteLine("Hello, World!");
diff --git a/src/Tests/TestStubEF/TestStubEF.csproj b/src/Tests/TestStubEF/TestStubEF.csproj
new file mode 100644
index 0000000..206b89a
--- /dev/null
+++ b/src/Tests/TestStubEF/TestStubEF.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+