tests unitaires qui marchent sans mettre la LargeImage dans la classe ChampionEntity pour l'instant

pull/1/head
Théo DUPIN 2 years ago
parent 43930e378c
commit b5fb781d34

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace DBDataManager namespace DBDataManager
{ {
public class DBDataManager //: IDataManager public class DBDataManager //: IDataManager-
{ {
//public IChampionsManager ChampionsManager => new DBChampionManager(); //public IChampionsManager ChampionsManager => new DBChampionManager();

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -14,7 +15,7 @@ namespace EntityFrameworkLib
public string Name { get; set; } public string Name { get; set; }
public string Bio { get; set; } public string Bio { get; set; }
public string Icon { get; set; } public string Icon { get; set; }
public LargeImage Image { get; set; } //public LargeImage Image { get; set; }
public ChampionClass Class { get; set; } //public ChampionClass Class { get; set; }
} }
} }

@ -1,14 +1,14 @@
using System; using System;
using System.Data.Common; using System.Data.Common;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Model;
namespace EntityFrameworkLib namespace EntityFrameworkLib
{ {
public class LolContext : DbContext public class LolContext : DbContext
{ {
public DbSet<ChampionEntity> Champions { get; set; } public DbSet<ChampionEntity> Champions { get; set; }
public LolContext() { }
public LolContext () { }
public LolContext(DbContextOptions<LolContext> options) public LolContext(DbContextOptions<LolContext> options)
: base(options) { } : base(options) { }
@ -19,5 +19,14 @@ namespace EntityFrameworkLib
base.OnConfiguring(options.UseSqlite($"DataSource=projet.Champions.db")); base.OnConfiguring(options.UseSqlite($"DataSource=projet.Champions.db"));
} }
} }
/*protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ChampionEntity>()
.Property(c => c.Image)
.IsRequired(false);
modelBuilder.Entity<LargeImage>()
.HasKey(li => li.Base64);
}*/
} }
} }

@ -11,7 +11,7 @@ namespace EntityFrameworkLib.Mappers
{ {
public static Champion toModel(this ChampionEntity championEntity) public static Champion toModel(this ChampionEntity championEntity)
{ {
return new Champion(championEntity.Name, championEntity.Bio, championEntity.Icon, championEntity.Image, championEntity.Class); return new Champion(championEntity.Name, championEntity.Bio, championEntity.Icon /*championEntity.Image, championEntity.Class*/);
} }
public static ChampionEntity toEntity(this Champion champion) public static ChampionEntity toEntity(this Champion champion)
@ -21,8 +21,8 @@ namespace EntityFrameworkLib.Mappers
Name = champion.Name, Name = champion.Name,
Bio = champion.Bio, Bio = champion.Bio,
Icon = champion.Icon, Icon = champion.Icon,
Image = champion.Image, //Image = champion.Image,
Class = champion.Class, //Class = champion.Class,
}; };
} }
} }

@ -66,7 +66,7 @@ public class Champion : IEquatable<Champion>
Class = @class; Class = @class;
} }
public Champion(string name, string bio) public Champion(string name, string bio, string icon)
{ {
this.name = name; this.name = name;
this.bio = bio; this.bio = bio;

Loading…
Cancel
Save