From 9536d387454ed00cff67223916503f773bf2e0ff Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Sat, 4 Feb 2023 11:02:32 +0100
Subject: [PATCH 1/2] =?UTF-8?q?:rocket:=20cr=C3=A9ation=20d'une=20branche?=
=?UTF-8?q?=20perso=20pour=20eviter=20les=20conflits,=20et=20mise=20sur=20?=
=?UTF-8?q?le=20depots=20du=20code=20:=20la=20creation=20de=20champion=20e?=
=?UTF-8?q?n=20base=20de=20donn=C3=A9e=20avec=20nom,=20bio=20et=20icone=20?=
=?UTF-8?q?:zap:?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
EF_LoL/EF_LoL.sln | 25 ++++++
EF_LoL/EF_LoL/ChampionDBContext.cs | 20 +++++
EF_LoL/EF_LoL/ChampionEntity.cs | 83 ++++++++++++++++++
EF_LoL/EF_LoL/EF_LoL.MyDataBase.db | Bin 0 -> 20480 bytes
EF_LoL/EF_LoL/EF_LoL.csproj | 21 +++++
.../20230204093038_MyMigration.Designer.cs | 42 +++++++++
.../Migrations/20230204093038_MyMigration.cs | 34 +++++++
.../ChampionDBContextModelSnapshot.cs | 39 ++++++++
EF_LoL/EF_LoL/MyDataBase.db | 0
EF_LoL/EF_LoL/Program.cs | 28 ++++++
10 files changed, 292 insertions(+)
create mode 100644 EF_LoL/EF_LoL.sln
create mode 100644 EF_LoL/EF_LoL/ChampionDBContext.cs
create mode 100644 EF_LoL/EF_LoL/ChampionEntity.cs
create mode 100644 EF_LoL/EF_LoL/EF_LoL.MyDataBase.db
create mode 100644 EF_LoL/EF_LoL/EF_LoL.csproj
create mode 100644 EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.Designer.cs
create mode 100644 EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.cs
create mode 100644 EF_LoL/EF_LoL/Migrations/ChampionDBContextModelSnapshot.cs
create mode 100644 EF_LoL/EF_LoL/MyDataBase.db
create mode 100644 EF_LoL/EF_LoL/Program.cs
diff --git a/EF_LoL/EF_LoL.sln b/EF_LoL/EF_LoL.sln
new file mode 100644
index 0000000..856e14b
--- /dev/null
+++ b/EF_LoL/EF_LoL.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33213.308
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EF_LoL", "EF_LoL\EF_LoL.csproj", "{1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1EA5AF67-3A7C-4B6B-BE39-837D683F5AB3}
+ EndGlobalSection
+EndGlobal
diff --git a/EF_LoL/EF_LoL/ChampionDBContext.cs b/EF_LoL/EF_LoL/ChampionDBContext.cs
new file mode 100644
index 0000000..8536a46
--- /dev/null
+++ b/EF_LoL/EF_LoL/ChampionDBContext.cs
@@ -0,0 +1,20 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EF_LoL
+{
+ public class ChampionDBContext : DbContext
+ {
+
+ //ChampionEntity champ1 = new ChampionEntity("Bob");
+ //ChampionEntity champ2 = new ChampionEntity("Fanta");
+
+ public DbSet ChampionEntity { get; set; }
+ protected override void OnConfiguring(DbContextOptionsBuilder options)
+ => options.UseSqlite("Data Source= EF_LoL.MyDataBase.db");
+ }
+}
diff --git a/EF_LoL/EF_LoL/ChampionEntity.cs b/EF_LoL/EF_LoL/ChampionEntity.cs
new file mode 100644
index 0000000..276445c
--- /dev/null
+++ b/EF_LoL/EF_LoL/ChampionEntity.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EF_LoL
+{
+ public class ChampionEntity
+ {
+ //dotnet ef database update --context ChampionDBContext --project EF_LoL
+ [Key]
+ public string Name
+ {
+ get => name;
+ private init
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ name = "Unknown";
+ return;
+ }
+ name = value;
+ }
+ }
+ private readonly string name = null!;
+
+ public string Bio
+ {
+ get => bio;
+ set
+ {
+ if (value == null)
+ {
+ bio = "";
+ return;
+ }
+ bio = value;
+ }
+ }
+ private string bio = "";
+
+ public string Icon { get; set; }
+
+ public ChampionEntity(string name, string icon = "", string bio = "")
+ {
+ Name = name;
+ Icon = icon;
+ Bio = bio;
+ }
+
+ // creer tabl avec db context et db set de champion
+ // puis ajout d'un nouveau champion
+ // pour ajouté un attribut : supprimer nos migrations et nos db
+
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(obj, null)) return false;
+ if (ReferenceEquals(obj, this)) return true;
+ if (GetType() != obj.GetType()) return false;
+ return Equals(obj as ChampionEntity);
+ }
+
+ public override int GetHashCode()
+ => Name.GetHashCode() % 997;
+
+ public bool Equals(ChampionEntity? other)
+ => Name.Equals(other?.Name);
+
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder($"{Name}");
+ if (!string.IsNullOrWhiteSpace(bio))
+ {
+ sb.AppendLine($"\t{bio}");
+ }
+ return sb.ToString();
+ }
+ }
+}
diff --git a/EF_LoL/EF_LoL/EF_LoL.MyDataBase.db b/EF_LoL/EF_LoL/EF_LoL.MyDataBase.db
new file mode 100644
index 0000000000000000000000000000000000000000..2a3e632a6630951fe99233d4eba425f6d85e5d67
GIT binary patch
literal 20480
zcmeI%J#W)M7zgk>pWCJpSF==>kWf#ah=d|HK?+qD+{g&4c_THb8Ia{BhFUZ+IIc>@
z_B-$~_$XbNVSojR4Y4qCu1Fx3EwM)WKl16GyR*;sPhReP^t2Twfp{6kV?Pmfa+@d$
zc_aiOgvqid%RCgBsPl%b=|6c<%1G6_!?j;T<=15EqxOMcZ@n)%8T}A|00bZa0SG_<
z0uX=z1R(IA0+%-1&?^;sWheg0S%p~&>
zXBbT~L%dwsSJ(A!g_3YG3f@iMp2-!e=btChO*?Z#Z+H0t)-I3fhTdqmfNW;ljNTBS7tG%Gs?U`7N}sN9H(9!jn0S3^B|tehs{hYT^way
zf6*v%$-R%ao7
+
+
+ Exe
+ net6.0
+ enable
+ enable
+ $(MSBuildProjectDirectory)
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
diff --git a/EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.Designer.cs b/EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.Designer.cs
new file mode 100644
index 0000000..e4053f1
--- /dev/null
+++ b/EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.Designer.cs
@@ -0,0 +1,42 @@
+//
+using EF_LoL;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EFLoL.Migrations
+{
+ [DbContext(typeof(ChampionDBContext))]
+ [Migration("20230204093038_MyMigration")]
+ partial class MyMigration
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+
+ modelBuilder.Entity("EF_LoL.ChampionEntity", b =>
+ {
+ b.Property("Name")
+ .HasColumnType("TEXT");
+
+ b.Property("Bio")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Icon")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Name");
+
+ b.ToTable("ChampionEntity");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.cs b/EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.cs
new file mode 100644
index 0000000..d92c2cf
--- /dev/null
+++ b/EF_LoL/EF_LoL/Migrations/20230204093038_MyMigration.cs
@@ -0,0 +1,34 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EFLoL.Migrations
+{
+ ///
+ public partial class MyMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "ChampionEntity",
+ columns: table => new
+ {
+ Name = table.Column(type: "TEXT", nullable: false),
+ Bio = table.Column(type: "TEXT", nullable: false),
+ Icon = table.Column(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ChampionEntity", x => x.Name);
+ });
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "ChampionEntity");
+ }
+ }
+}
diff --git a/EF_LoL/EF_LoL/Migrations/ChampionDBContextModelSnapshot.cs b/EF_LoL/EF_LoL/Migrations/ChampionDBContextModelSnapshot.cs
new file mode 100644
index 0000000..4f2de8c
--- /dev/null
+++ b/EF_LoL/EF_LoL/Migrations/ChampionDBContextModelSnapshot.cs
@@ -0,0 +1,39 @@
+//
+using EF_LoL;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EFLoL.Migrations
+{
+ [DbContext(typeof(ChampionDBContext))]
+ partial class ChampionDBContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+
+ modelBuilder.Entity("EF_LoL.ChampionEntity", b =>
+ {
+ b.Property("Name")
+ .HasColumnType("TEXT");
+
+ b.Property("Bio")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Icon")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.HasKey("Name");
+
+ b.ToTable("ChampionEntity");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/EF_LoL/EF_LoL/MyDataBase.db b/EF_LoL/EF_LoL/MyDataBase.db
new file mode 100644
index 0000000..e69de29
diff --git a/EF_LoL/EF_LoL/Program.cs b/EF_LoL/EF_LoL/Program.cs
new file mode 100644
index 0000000..1b49a9d
--- /dev/null
+++ b/EF_LoL/EF_LoL/Program.cs
@@ -0,0 +1,28 @@
+// See https://aka.ms/new-console-template for more information
+using EF_LoL;
+
+Console.WriteLine("Hello, World!");
+
+
+ChampionEntity chewie = new ChampionEntity("Chewbacca");
+ChampionEntity yoda = new ChampionEntity ("Yoda");
+ChampionEntity ewok = new ChampionEntity ("Ewok");
+
+using (var context = new ChampionDBContext())
+{
+ // Crée des Champion et les insère dans la base
+ Console.WriteLine("Creates and inserts new Champion");
+ context.ChampionEntity.Add(chewie);
+ context.Add(yoda);
+ context.Add(ewok);
+ context.SaveChanges();
+}
+
+using (var context = new ChampionDBContext())
+{
+ foreach (var n in context.ChampionEntity)
+ {
+ Console.WriteLine($"{n.Name} - {n.Bio} [ {n.Icon} ]");
+ }
+ context.SaveChanges();
+}
--
2.36.3
From 93a1c42ad205b2dd9fee3720002aad9af0d36a55 Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Sat, 4 Feb 2023 12:03:28 +0100
Subject: [PATCH 2/2] =?UTF-8?q?:test=5Ftube:=20ajout=20du=20premier=20test?=
=?UTF-8?q?=20et=20des=20charact=C3=A9ristiques(pb=20sur=20cette=20derni?=
=?UTF-8?q?=C3=A8re=20nonobstant..)=20:adhesive=5Fbandage:?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
EF_LoL/EF_LoL.sln | 8 ++++-
EF_LoL/EF_LoL/ChampionDBContext.cs | 17 +++++++++-
EF_LoL/EF_LoL/ChampionEntity.cs | 45 ++++++++++++++++++++++++++-
EF_LoL/EF_LoL/EF_LoL.csproj | 1 +
EF_LoL/EF_LoL/Program.cs | 4 +--
EF_LoL/TestProject/TestProject.csproj | 29 +++++++++++++++++
EF_LoL/TestProject/UnitTest1.cs | 45 +++++++++++++++++++++++++++
EF_LoL/TestProject/Usings.cs | 1 +
8 files changed, 145 insertions(+), 5 deletions(-)
create mode 100644 EF_LoL/TestProject/TestProject.csproj
create mode 100644 EF_LoL/TestProject/UnitTest1.cs
create mode 100644 EF_LoL/TestProject/Usings.cs
diff --git a/EF_LoL/EF_LoL.sln b/EF_LoL/EF_LoL.sln
index 856e14b..98ae8a2 100644
--- a/EF_LoL/EF_LoL.sln
+++ b/EF_LoL/EF_LoL.sln
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EF_LoL", "EF_LoL\EF_LoL.csproj", "{1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EF_LoL", "EF_LoL\EF_LoL.csproj", "{1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "TestProject\TestProject.csproj", "{1A0B75E2-ECCE-47F3-A8FB-79F48F76E9A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1AF6FE09-1ABF-4C51-8EC6-D2938876AAD2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1A0B75E2-ECCE-47F3-A8FB-79F48F76E9A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1A0B75E2-ECCE-47F3-A8FB-79F48F76E9A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1A0B75E2-ECCE-47F3-A8FB-79F48F76E9A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1A0B75E2-ECCE-47F3-A8FB-79F48F76E9A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/EF_LoL/EF_LoL/ChampionDBContext.cs b/EF_LoL/EF_LoL/ChampionDBContext.cs
index 8536a46..eb85489 100644
--- a/EF_LoL/EF_LoL/ChampionDBContext.cs
+++ b/EF_LoL/EF_LoL/ChampionDBContext.cs
@@ -9,12 +9,27 @@ namespace EF_LoL
{
public class ChampionDBContext : DbContext
{
+ public ChampionDBContext()
+ { }
+
+ public ChampionDBContext(DbContextOptions options)
+ : base(options)
+ { }
//ChampionEntity champ1 = new ChampionEntity("Bob");
//ChampionEntity champ2 = new ChampionEntity("Fanta");
public DbSet ChampionEntity { get; set; }
+
+ //protected override void OnConfiguring(DbContextOptionsBuilder options)
+ // => options.UseSqlite("Data Source= EF_LoL.MyDataBase.db");
+
protected override void OnConfiguring(DbContextOptionsBuilder options)
- => options.UseSqlite("Data Source= EF_LoL.MyDataBase.db");
+ {
+ if (!options.IsConfigured)
+ {
+ options.UseSqlite("Data Source= EF_LoL.MyDataBase.db");
+ }
+ }
}
}
diff --git a/EF_LoL/EF_LoL/ChampionEntity.cs b/EF_LoL/EF_LoL/ChampionEntity.cs
index 276445c..9a764d9 100644
--- a/EF_LoL/EF_LoL/ChampionEntity.cs
+++ b/EF_LoL/EF_LoL/ChampionEntity.cs
@@ -4,6 +4,7 @@ using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
+using System.Reflection.PortableExecutable;
using System.Text;
using System.Threading.Tasks;
@@ -45,14 +46,22 @@ namespace EF_LoL
public string Icon { get; set; }
+
+
+
public ChampionEntity(string name, string icon = "", string bio = "")
{
Name = name;
Icon = icon;
Bio = bio;
+ ///Characteristics = new ReadOnlyDictionary(characteristics);
}
- // creer tabl avec db context et db set de champion
+ ///public ReadOnlyDictionary Characteristics { get; private set; }
+ ///private readonly Dictionary characteristics = new Dictionary();
+
+
+ // creer table avec db context et db set de champion
// puis ajout d'un nouveau champion
// pour ajouté un attribut : supprimer nos migrations et nos db
@@ -79,5 +88,39 @@ namespace EF_LoL
}
return sb.ToString();
}
+
+
+
+ ///// Characteristique
+
+ ////public void AddCharacteristics(params Tuple[] someCharacteristics)
+ ////{
+ //// foreach (var c in someCharacteristics)
+ //// {
+ //// characteristics[c.Item1] = c.Item2;
+ //// }
+ ////}
+
+ ////public bool RemoveCharacteristics(string label)
+ //// => characteristics.Remove(label);
+
+ ////public int? this[string label]
+ ////{
+ //// get
+ //// {
+ //// if (!characteristics.TryGetValue(label, out int value)) return null;
+ //// else return value;
+ //// }
+ //// set
+ //// {
+ //// if (!value.HasValue)
+ //// {
+ //// RemoveCharacteristics(label);
+ //// return;
+ //// }
+ //// characteristics[label] = value.Value;
+ //// }
+ ////}
+
}
}
diff --git a/EF_LoL/EF_LoL/EF_LoL.csproj b/EF_LoL/EF_LoL/EF_LoL.csproj
index 500c36b..b1028b0 100644
--- a/EF_LoL/EF_LoL/EF_LoL.csproj
+++ b/EF_LoL/EF_LoL/EF_LoL.csproj
@@ -10,6 +10,7 @@
+
diff --git a/EF_LoL/EF_LoL/Program.cs b/EF_LoL/EF_LoL/Program.cs
index 1b49a9d..cb608c3 100644
--- a/EF_LoL/EF_LoL/Program.cs
+++ b/EF_LoL/EF_LoL/Program.cs
@@ -13,8 +13,8 @@ using (var context = new ChampionDBContext())
// Crée des Champion et les insère dans la base
Console.WriteLine("Creates and inserts new Champion");
context.ChampionEntity.Add(chewie);
- context.Add(yoda);
- context.Add(ewok);
+ context.ChampionEntity.Add(yoda);
+ context.ChampionEntity.Add(ewok);
context.SaveChanges();
}
diff --git a/EF_LoL/TestProject/TestProject.csproj b/EF_LoL/TestProject/TestProject.csproj
new file mode 100644
index 0000000..0c2b451
--- /dev/null
+++ b/EF_LoL/TestProject/TestProject.csproj
@@ -0,0 +1,29 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+ false
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
diff --git a/EF_LoL/TestProject/UnitTest1.cs b/EF_LoL/TestProject/UnitTest1.cs
new file mode 100644
index 0000000..743eb8d
--- /dev/null
+++ b/EF_LoL/TestProject/UnitTest1.cs
@@ -0,0 +1,45 @@
+using EF_LoL;
+using Microsoft.EntityFrameworkCore;
+using System.Linq;
+using Xunit;
+
+
+namespace TestProject
+{
+
+ public class UnitTest1
+ {
+ [Fact]
+ public void Test1()
+ {
+ var options = new DbContextOptionsBuilder()
+ .UseInMemoryDatabase(databaseName: "Add_Test_database")
+ .Options;
+
+ //prepares the database with one instance of the context
+ using (var context = new ChampionDBContext(options))
+ {
+
+ ChampionEntity chewie = new ChampionEntity("Chewbacca");
+ ChampionEntity yoda = new ChampionEntity("Yoda");
+ ChampionEntity ewok = new ChampionEntity("Ewok");
+
+
+ Console.WriteLine("Creates and inserts new Champion for tests");
+ context.ChampionEntity.Add(chewie);
+ context.ChampionEntity.Add(yoda);
+ context.ChampionEntity.Add(ewok);
+ context.SaveChanges();
+ }
+
+ //prepares the database with one instance of the context
+ using (var context = new ChampionDBContext(options))
+ {
+ Assert.Equal(3, context.ChampionEntity.Count());
+ Assert.Equal("Chewbacca", context.ChampionEntity.First().Name);
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/EF_LoL/TestProject/Usings.cs b/EF_LoL/TestProject/Usings.cs
new file mode 100644
index 0000000..8c927eb
--- /dev/null
+++ b/EF_LoL/TestProject/Usings.cs
@@ -0,0 +1 @@
+global using Xunit;
\ No newline at end of file
--
2.36.3