Update EF & Add Test
continuous-integration/drone/push Build is failing Details

master
Louis DUFOUR 2 years ago
parent 67846dbb1f
commit 2d89221e53

File diff suppressed because one or more lines are too long

@ -16,11 +16,16 @@ namespace EFManager
// Skin
public static EFSkin toEF(this Skin Skin) => new EFSkin { Name = Skin.Name, Description = Skin.Description, Icon = Skin.Icon, Price = Skin.Price };
public static Skin toModel(this EFSkin EFSkin) => new Skin(EFSkin.Name, EFSkin.champion.toModel());
public static Skin toModel(this EFSkin EFSkin) => new Skin(EFSkin.Name, EFSkin.Champion.toModel());
// Skill
// Rune
// LargeImage
public static EFLargeImage toEF(this LargeImage LargeImage) => new EFLargeImage { Id = Guid.NewGuid(), Base64 = LargeImage.Base64 };
public static LargeImage toModel(this EFLargeImage EFlargeImage) => new LargeImage(EFlargeImage.Base64);
}
}

@ -3,5 +3,6 @@
public class EFChampionMapper
{
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFMapping
{
public class EFRuneMapper
{
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFMapping
{
public class EFRunePageMapper
{
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFMapping
{
public class EFSkillMapper
{
}
}

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFMapping
{
public class EFSkinMapper
{
}
}

@ -1,5 +1,6 @@

using Model;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
@ -13,19 +14,21 @@ namespace EFlib
[Key]
[MaxLength(256)]
public string Name { get; set; }
[MaxLength(500)]
public string Bio { get; set; }
public string Icon { get; set; }
public List<KeyValuePair<string, int>> CharacteristicsList { get; set; }
public ReadOnlyDictionary<string, int> Characteristics => new ReadOnlyDictionary<string, int>(CharacteristicsList.ToDictionary(kv => kv.Key, kv => kv.Value));
// Propriété de navigation pour les paires clé-valeur
public ICollection<EFCharacteristics> Characteristics { get; set; }
[Required]
public ChampionClass Class { get; set; }
public ReadOnlyCollection<EFSkin> Skins { get; private set; }
public ImmutableHashSet<EFSkill> Skills { get; private set; }
public ReadOnlyCollection<EFSkin>? Skins { get; set; }
public ImmutableHashSet<EFSkill> Skills { get; set; }
public Guid ImageId { get; set; }
[ForeignKey("ImageId")]
public EFLargeImage Image { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EFlib
{
public class EFCharacteristics
{
[Key]
public int Id { get; set; }
public string Name { get; set; }
public int Value { get; set; }
// Clé étrangère vers l'entité parente
[ForeignKey("EFChampion")]
public string EFChampionName { get; set; }
public EFChampion EFChampion { get; set; }
}
}

@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
@ -11,10 +12,6 @@ namespace EFlib
{
public class EFRune
{
[Key]
public string Name { get; set; }
public string Description { get; set; }
public RuneFamily Family { get; set; }
public EFLargeImage Image { get; set; }
}
}

@ -1,7 +1,9 @@
using System;
using Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -11,9 +13,5 @@ namespace EFlib
{
public class EFRunePage
{
[Key]
public string Name { get; set; }
public List<KeyValuePair<Category, EFRune>> RunesList { get; set; }
public ReadOnlyDictionary<Category, EFRune> Runes => new ReadOnlyDictionary<Category, EFRune>(RunesList.ToDictionary(kv => kv.Key, kv => kv.Value));
}
}

@ -1,5 +1,7 @@
using Model;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;
namespace EFlib
{
@ -8,11 +10,18 @@ namespace EFlib
/**** Attributs ****/
[Key]
public string Name { get; set; }
public EFChampion champion { get; set; }
public string Description { get; set; }
public string Icon { get; set; }
public float Price { get; set; }
public Guid ImageId { get; set; }
[ForeignKey("ImageId")]
public EFLargeImage Image { get; set; }
public string NameChampion { get; set; }
[ForeignKey("NameChampion")]
public EFChampion Champion { get; set; }
}
}

@ -0,0 +1,203 @@
// <auto-generated />
using System;
using EFlib;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EFlib.Migrations
{
[DbContext(typeof(SQLiteContext))]
[Migration("20230318182850_myMigrations")]
partial class myMigrations
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("EFlib.EFChampion", b =>
{
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("Bio")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<Guid>("ImageId")
.HasColumnType("TEXT");
b.HasKey("Name");
b.HasIndex("ImageId");
b.ToTable("Champions");
});
modelBuilder.Entity("EFlib.EFCharacteristics", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("EFChampionName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Value")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("EFChampionName");
b.ToTable("EFCharacteristics");
});
modelBuilder.Entity("EFlib.EFLargeImage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("EFLargeImage");
});
modelBuilder.Entity("EFlib.EFSkill", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EFChampionName")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("Name");
b.HasIndex("EFChampionName");
b.ToTable("Skills");
});
modelBuilder.Entity("EFlib.EFSkin", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<Guid>("ImageId")
.HasColumnType("TEXT");
b.Property<string>("NameChampion")
.IsRequired()
.HasColumnType("TEXT");
b.Property<float>("Price")
.HasColumnType("REAL");
b.HasKey("Name");
b.HasIndex("ImageId");
b.HasIndex("NameChampion");
b.ToTable("Skins");
});
modelBuilder.Entity("EFlib.EFChampion", b =>
{
b.HasOne("EFlib.EFLargeImage", "Image")
.WithMany()
.HasForeignKey("ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EFlib.EFCharacteristics", b =>
{
b.HasOne("EFlib.EFChampion", "EFChampion")
.WithMany("Characteristics")
.HasForeignKey("EFChampionName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EFChampion");
});
modelBuilder.Entity("EFlib.EFSkill", b =>
{
b.HasOne("EFlib.EFChampion", null)
.WithMany("Skills")
.HasForeignKey("EFChampionName");
});
modelBuilder.Entity("EFlib.EFSkin", b =>
{
b.HasOne("EFlib.EFLargeImage", "Image")
.WithMany()
.HasForeignKey("ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EFlib.EFChampion", "Champion")
.WithMany("Skins")
.HasForeignKey("NameChampion")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champion");
b.Navigation("Image");
});
modelBuilder.Entity("EFlib.EFChampion", b =>
{
b.Navigation("Characteristics");
b.Navigation("Skills");
b.Navigation("Skins");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,160 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EFlib.Migrations
{
/// <inheritdoc />
public partial class myMigrations : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EFLargeImage",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Base64 = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFLargeImage", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Champions",
columns: table => new
{
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false),
Bio = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Class = table.Column<int>(type: "INTEGER", nullable: false),
ImageId = table.Column<Guid>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Champions", x => x.Name);
table.ForeignKey(
name: "FK_Champions_EFLargeImage_ImageId",
column: x => x.ImageId,
principalTable: "EFLargeImage",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EFCharacteristics",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Value = table.Column<int>(type: "INTEGER", nullable: false),
EFChampionName = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EFCharacteristics", x => x.Id);
table.ForeignKey(
name: "FK_EFCharacteristics_Champions_EFChampionName",
column: x => x.EFChampionName,
principalTable: "Champions",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Skills",
columns: table => new
{
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
EFChampionName = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Skills", x => x.Name);
table.ForeignKey(
name: "FK_Skills_Champions_EFChampionName",
column: x => x.EFChampionName,
principalTable: "Champions",
principalColumn: "Name");
});
migrationBuilder.CreateTable(
name: "Skins",
columns: table => new
{
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<float>(type: "REAL", nullable: false),
ImageId = table.Column<Guid>(type: "TEXT", nullable: false),
NameChampion = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skins", x => x.Name);
table.ForeignKey(
name: "FK_Skins_Champions_NameChampion",
column: x => x.NameChampion,
principalTable: "Champions",
principalColumn: "Name",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Skins_EFLargeImage_ImageId",
column: x => x.ImageId,
principalTable: "EFLargeImage",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Champions_ImageId",
table: "Champions",
column: "ImageId");
migrationBuilder.CreateIndex(
name: "IX_EFCharacteristics_EFChampionName",
table: "EFCharacteristics",
column: "EFChampionName");
migrationBuilder.CreateIndex(
name: "IX_Skills_EFChampionName",
table: "Skills",
column: "EFChampionName");
migrationBuilder.CreateIndex(
name: "IX_Skins_ImageId",
table: "Skins",
column: "ImageId");
migrationBuilder.CreateIndex(
name: "IX_Skins_NameChampion",
table: "Skins",
column: "NameChampion");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EFCharacteristics");
migrationBuilder.DropTable(
name: "Skills");
migrationBuilder.DropTable(
name: "Skins");
migrationBuilder.DropTable(
name: "Champions");
migrationBuilder.DropTable(
name: "EFLargeImage");
}
}
}

@ -0,0 +1,200 @@
// <auto-generated />
using System;
using EFlib;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EFlib.Migrations
{
[DbContext(typeof(SQLiteContext))]
partial class SQLiteContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("EFlib.EFChampion", b =>
{
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("Bio")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<Guid>("ImageId")
.HasColumnType("TEXT");
b.HasKey("Name");
b.HasIndex("ImageId");
b.ToTable("Champions");
});
modelBuilder.Entity("EFlib.EFCharacteristics", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("EFChampionName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Value")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("EFChampionName");
b.ToTable("EFCharacteristics");
});
modelBuilder.Entity("EFlib.EFLargeImage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("EFLargeImage");
});
modelBuilder.Entity("EFlib.EFSkill", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("EFChampionName")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("Name");
b.HasIndex("EFChampionName");
b.ToTable("Skills");
});
modelBuilder.Entity("EFlib.EFSkin", b =>
{
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<Guid>("ImageId")
.HasColumnType("TEXT");
b.Property<string>("NameChampion")
.IsRequired()
.HasColumnType("TEXT");
b.Property<float>("Price")
.HasColumnType("REAL");
b.HasKey("Name");
b.HasIndex("ImageId");
b.HasIndex("NameChampion");
b.ToTable("Skins");
});
modelBuilder.Entity("EFlib.EFChampion", b =>
{
b.HasOne("EFlib.EFLargeImage", "Image")
.WithMany()
.HasForeignKey("ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EFlib.EFCharacteristics", b =>
{
b.HasOne("EFlib.EFChampion", "EFChampion")
.WithMany("Characteristics")
.HasForeignKey("EFChampionName")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EFChampion");
});
modelBuilder.Entity("EFlib.EFSkill", b =>
{
b.HasOne("EFlib.EFChampion", null)
.WithMany("Skills")
.HasForeignKey("EFChampionName");
});
modelBuilder.Entity("EFlib.EFSkin", b =>
{
b.HasOne("EFlib.EFLargeImage", "Image")
.WithMany()
.HasForeignKey("ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EFlib.EFChampion", "Champion")
.WithMany("Skins")
.HasForeignKey("NameChampion")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champion");
b.Navigation("Image");
});
modelBuilder.Entity("EFlib.EFChampion", b =>
{
b.Navigation("Characteristics");
b.Navigation("Skills");
b.Navigation("Skins");
});
#pragma warning restore 612, 618
}
}
}

@ -8,8 +8,6 @@ namespace EFlib
public DbSet<EFChampion> Champions { get; set; }
public DbSet<EFSkin> Skins { get; set; }
public DbSet<EFSkill> Skills { get; set; }
public DbSet<EFRune> Runes { get; set; }
public DbSet<EFRunePage> RunePages { get; set; }
/**** Méthodes ****/
public SQLiteContext()
@ -26,10 +24,5 @@ namespace EFlib
optionsBuilder.UseSqlite($"Data Source=projet.dbloulou.db");
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// TODO
}
}
}

Binary file not shown.

@ -35,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestManagerEF", "Tests\Test
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestAPI", "TestAPI\TestAPI.csproj", "{F7B6A3D6-6C70-49DC-9D1D-4B70071EEF25}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFMapping", "EFMapping\EFMapping.csproj", "{33567480-B38B-4A1E-9A81-6F4136A09C15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -95,10 +93,6 @@ Global
{F7B6A3D6-6C70-49DC-9D1D-4B70071EEF25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7B6A3D6-6C70-49DC-9D1D-4B70071EEF25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7B6A3D6-6C70-49DC-9D1D-4B70071EEF25}.Release|Any CPU.Build.0 = Release|Any CPU
{33567480-B38B-4A1E-9A81-6F4136A09C15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33567480-B38B-4A1E-9A81-6F4136A09C15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33567480-B38B-4A1E-9A81-6F4136A09C15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33567480-B38B-4A1E-9A81-6F4136A09C15}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -1,13 +1,90 @@
using EFlib;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Model;
using StubEF;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Reflection.PortableExecutable;
using Xunit;
namespace TestEF
{
/*public class UniTestChampion
public class UniTestChampion
{
[Fact]
public async Task AddChampion_Test()
{
// connection must be opened to use In-memory database
var connection = new SqliteConnection("DataSource =:memory:");
connection.Open();
var options = new DbContextOptionsBuilder<SQLiteContext>().UseSqlite(connection).Options;
using (var context = new SQLiteContext(options))
{
await context.Database.EnsureCreatedAsync(); //pour créer la base si elle n'existe pas déjà
// Arrange
EFChampion champion = new EFChampion
{
Name = "Champion 1",
Bio = "Bio Champion 1",
Icon = "aatrox_icon.jpg",
Class = ChampionClass.Assassin,
Characteristics = new List<EFCharacteristics> {
new EFCharacteristics { Name = "Attack Damage", Value = 60 },
new EFCharacteristics { Name = "Armor", Value = 38 },
new EFCharacteristics { Name = "Magic Resist", Value = 32 }
},
Skills = ImmutableHashSet.Create<EFSkill>(
new EFSkill { Name = "Skill 1", Description = "Desc Skill 1" },
new EFSkill { Name = "Skill 2", Description = "Desc Skill 2" }
),
Skins = new ReadOnlyCollection<EFSkin>(new List<EFSkin> {
new EFSkin
{
Name = "Mecha Kingdoms Aatrox",
Description = "In a distant cyberfuture, the champion Aatrox becomes a symbol of ultimate power and glory...",
Icon = "aatrox_mecha_icon.jpg",
Price = 1350,
NameChampion = "Aatrox",
ImageId = Guid.NewGuid(),
Image = new EFLargeImage { Id = Guid.NewGuid(), Base64 = "aatrox_mecha_splash.jpg" }
} } ),
Image = new EFLargeImage { Id = Guid.NewGuid(), Base64 = "CheminDeMonChampion" }
};
context.Add(champion);
await context.SaveChangesAsync();
// Act
await context.Champions.FirstOrDefaultAsync(c => c.Name == "Champion 1");
// Assert
Assert.NotNull(champion);
Assert.Equal("Bio Champion 1", champion.Bio);
Assert.Equal("aatrox_icon.jpg", champion.Icon);
Assert.NotNull(champion.Characteristics);
Assert.Equal(3, champion.Characteristics.Count);
Assert.Equal(ChampionClass.Assassin, champion.Class);
Assert.Single(champion.Skins);
if (champion.Skins.Any())
{
Assert.Equal("Mecha Kingdoms Aatrox", champion.Skins[0].Name);
}
Assert.Equal(2, champion.Skills.Count);
Assert.Contains(champion.Skills, s => s.Name == "Skill 1");
Assert.Contains(champion.Skills, s => s.Name == "Skill 2");
Assert.Equal("CheminDeMonChampion", champion.Image.Base64);
}
}
[Fact]
public async Task GetChampion_Test()
{
@ -22,12 +99,16 @@ namespace TestEF
//context.Database.OpenConnection();
await context.Database.EnsureCreatedAsync(); //pour créer la base si elle n'existe pas déjà
var champs = context.Champions.SingleOrDefault(c=> c.Name == "Akali");
var champs = context.Champions.SingleOrDefault(c => c.Name == "Akali");
Assert.NotNull(champs);
Assert.Equal("Akali", champs.Name);
}
}*/
}
}
/*
[Fact]
public void Modify_Test()
@ -128,4 +209,4 @@ namespace TestEF
} */
}
}
Loading…
Cancel
Save