Compare commits

..

20 Commits

Author SHA1 Message Date
Maxence LANONE 8619817ac5 Reajout de dbdatamanager
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE cfd98c2412 🤡 je sais pas ce que je commit
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE 7e7cb63859 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Maxence LANONE f6e2b37a62 🐛 fix test player
continuous-integration/drone/push Build is passing Details
2 years ago
Maxence LANONE 8e64c82e1f 🐛 fix test player
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE 2ce035db0b Merge remote-tracking branch 'refs/remotes/origin/master'
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE 4927665890 add test for player class
2 years ago
Maxence LANONE 1637cee73b Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Maxence LANONE c7cc318b36 add test for games (not very clean but passed)
continuous-integration/drone/push Build is passing Details
2 years ago
Maxence LANONE 8f8536ab1d 🔨 add jsonconverter for dictionary, requetes for games OK
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE 7b5206b161 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE f992120ad8 🐛 reglage build
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE 8933ae3150 🐛 reglage api players OK
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE 7e9768025c 🐛 fix build
continuous-integration/drone/push Build is passing Details
2 years ago
Théo DUPIN e7ba152332 Merge branch 'master' of https://codefirst.iut.uca.fr/git/Trek_Prod/Trek12_API
continuous-integration/drone/push Build is failing Details
2 years ago
Maxence LANONE ec282eae0b Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Marc CHEVALDONNE 6abd8d4d95 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
2 years ago
Théo DUPIN 87a98a5449 Ajout de l'entité ParticipateEntity et début des tests méthodes du model
continuous-integration/drone/push Build is failing Details
2 years ago
Théo DUPIN 8e4db752ea Ajout de Scores finaux dans la table Score sachant l'Id de la Game et l'id du Player concerné
continuous-integration/drone/push Build is failing Details
2 years ago
Théo DUPIN 078fa26bd4 Test d'ajout dans la table Score qui prend un nombre de points total, l'id d'une Game et l'id d'un Player
continuous-integration/drone/push Build is failing Details
2 years ago

@ -45,7 +45,7 @@ steps:
# accessible en ligne de commande par $${PLUGIN_SONAR_TOKEN}
sonar_token:
from_secret: SECRET_SONAR_LOGIN
depends on: [tests]
depends_on: [tests]
# docker image build
- name: docker-build
@ -54,7 +54,7 @@ steps:
dockerfile: Sources/Trek12_API/Dockerfile
context: Sources/
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/trek_prod/trek12_api
repo: hub.codefirst.iut.uca.fr/maxence.lanone/trek12_api
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
@ -64,11 +64,11 @@ steps:
- name: deploy-container
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: hub.codefirst.iut.uca.fr/trek_prod/trek12_api:latest
IMAGENAME: hub.codefirst.iut.uca.fr/maxence.lanone/trek12_api:latest
CONTAINERNAME: trek12api
COMMAND: create
OVERWRITE: true
ADMINS: maxencelanone, aurelienpintrand, theodupin, zakariyasaoula
ADMINS: maxencelanone,aurelienpintrand,theodupin,zakariyasaoula
depends_on: [ docker-build ]
volumes:

@ -1,15 +1,9 @@
[![Build Status](https://codefirst.iut.uca.fr/api/badges/Trek_Prod/Trek12_API/status.svg)](https://codefirst.iut.uca.fr/Trek_Prod/Trek12_API)
[![Quality Gate Status](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=alert_status)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Bugs](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=bugs)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Code Smells](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=code_smells)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Coverage](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=coverage)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Duplicated Lines (%)](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=duplicated_lines_density)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Lines of Code](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=ncloc)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Maintainability Rating](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=sqale_rating)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Reliability Rating](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=reliability_rating)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Security Rating](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=security_rating)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Technical Debt](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=sqale_index)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Vulnerabilities](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=vulnerabilities)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Quality Gate Status](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=alert_status&token=92713f88adaca17889743593e014bf147c0e764d)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Duplicated Lines (%)](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=duplicated_lines_density&token=92713f88adaca17889743593e014bf147c0e764d)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Coverage](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=coverage&token=92713f88adaca17889743593e014bf147c0e764d)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Maintainability Rating](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=sqale_rating&token=92713f88adaca17889743593e014bf147c0e764d)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
[![Security Hotspots](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Trek12_API&metric=security_hotspots&token=92713f88adaca17889743593e014bf147c0e764d)](https://codefirst.iut.uca.fr/sonar/dashboard?id=Trek12_API)
# Trek12_API

@ -1,34 +0,0 @@
using System;
using Model;
namespace DbDataManager
{
public class CaseManager: ICasesManager
{
public Task<Case?> AddItem(Case? item)
{
throw new NotImplementedException();
}
public Task<bool> DeleteItem(Case? item)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Case?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public Task<Case?> UpdateItem(Case? oldItem, Case? newItem)
{
throw new NotImplementedException();
}
}
}

@ -1,22 +1,20 @@
using System;
using Model;
using Model;
namespace DbDataManager
namespace DbDataManager;
public class DbDataManager : IDataManager
{
public class DbDataManager : IDataManager
{
public IPlayersManager PlayersMgr => new PlayerManager();
public IGamesManager GamesMgr => new GameManager();
public IPlayersManager PlayersMgr => throw new NotImplementedException();
public IGamesModeManager GamesModeMgr => new GameModeManager();
public IGamesManager GamesMgr => throw new NotImplementedException();
public ICasesManager CasesMgr => new CaseManager();
public IGamesModeManager GamesModeMgr => throw new NotImplementedException();
public IGrillesManager GrillesMgr => new GrilleManager();
public ICasesManager CasesMgr => throw new NotImplementedException();
public IStatsManager StatsMgr => new StatsManager();
public IGrillesManager GrillesMgr => throw new NotImplementedException();
public ITurnsManager TurnsMgr => new TurnManager();
}
public IStatsManager StatsMgr => throw new NotImplementedException();
public ITurnsManager TurnsMgr => throw new NotImplementedException();
}

@ -7,13 +7,6 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Sources\Trek12_Lib\EntityFrameWorkLib.csproj" />
<ProjectReference Include="..\Sources\Model\Model.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="Mapper\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Mapper\" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -1,64 +0,0 @@
using System;
using Model;
namespace DbDataManager
{
static class ExtensionDataManager
{
internal static Task<IEnumerable<T?>> GetItemsWithFilterAndOrdering<T>(this IEnumerable<T> collection,
Func<T, bool> filter, int index, int count, string? orderingPropertyName = null, bool descending = false)
{
IEnumerable<T> temp = collection;
temp = temp.Where(item => filter(item));
if (orderingPropertyName != null)
{
var prop = typeof(T).GetProperty(orderingPropertyName!);
if (prop != null)
{
temp = descending ? temp.OrderByDescending(item => prop.GetValue(item))
: temp.OrderBy(item => prop.GetValue(item));
}
}
return Task.FromResult<IEnumerable<T?>>(temp.Skip(index * count).Take(count));
}
internal static Task<int> GetNbItemsWithFilter<T>(this IEnumerable<T> collection, Func<T, bool> filter)
{
return Task.FromResult(collection.Count(item => filter(item)));
}
internal static Task<T?> AddItem<T>(this IList<T> collection, T? item)
{
if (item == null || collection.Contains(item))
{
return Task.FromResult<T?>(default(T));
}
collection.Add(item);
return Task.FromResult<T?>(item);
}
internal static Task<bool> DeleteItem<T>(this IList<T> collection, T? item)
{
if (item == null)
{
return Task.FromResult(false);
}
bool result = collection.Remove(item!);
return Task.FromResult(result);
}
internal static Task<T?> UpdateItem<T>(this IList<T> collection, T? oldItem, T? newItem)
{
if (oldItem == null || newItem == null) return Task.FromResult<T?>(default(T));
if (!collection.Contains(oldItem))
{
return Task.FromResult<T?>(default(T));
}
collection.Remove(oldItem!);
collection.Add(newItem!);
return Task.FromResult<T?>(newItem);
}
}
}

@ -1,76 +0,0 @@
using System;
using EntityFrameWorkLib;
using Model;
using System.Linq;
using Shared;
namespace DbDataManager
{
public class GameManager: IGamesManager
{
private TrekContext trekcontext;
public Task<bool> AddCaseValueToPlayer(int idGame, int idPlayer, int value, int index)
{
throw new NotImplementedException();
}
public async Task<Game?> AddItem(Game? item)
{
if (item == null)
{
return null;
}
var addItem = await trekcontext.AddAsync<Game>(item);
await trekcontext.SaveChangesAsync();
return addItem.Entity;
}
public Task<bool> AddPlayer(Player player)
{
throw new NotImplementedException();
}
public Task<bool> AddScoreToPlayer(int idGame, int idPlayer, int score)
{
throw new NotImplementedException();
}
public Task<bool> AddTime(TimeSpan time)
{
var game = trekcontext.Game.FirstOrDefault();
if (game == null)
{
return Task.FromResult(false);
}
game.AddTime(time);
return Task.FromResult(true);
}
public Task<bool> AddTurn(Turn turn)
{
throw new NotImplementedException();
}
public Task<bool> DeleteItem(Game? item)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Game?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public Task<Game?> UpdateItem(Game? oldItem, Game? newItem)
{
throw new NotImplementedException();
}
}
}

@ -1,34 +0,0 @@
using System;
using Model;
namespace DbDataManager
{
public class GameModeManager: IGamesModeManager
{
public Task<GameMode?> AddItem(GameMode? item)
{
throw new NotImplementedException();
}
public Task<bool> DeleteItem(GameMode? item)
{
throw new NotImplementedException();
}
public Task<IEnumerable<GameMode?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public Task<GameMode?> UpdateItem(GameMode? oldItem, GameMode? newItem)
{
throw new NotImplementedException();
}
}
}

@ -1,33 +0,0 @@
using System;
using Model;
namespace DbDataManager
{
public class GrilleManager: IGrillesManager
{
public Task<Grille?> AddItem(Grille? item)
{
throw new NotImplementedException();
}
public Task<bool> DeleteItem(Grille? item)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Grille?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public Task<Grille?> UpdateItem(Grille? oldItem, Grille? newItem)
{
throw new NotImplementedException();
}
}
}

@ -1,11 +0,0 @@
using System;
namespace DbDataManager.Mapper
{
public class CaseMapper
{
public CaseMapper()
{
}
}
}

@ -1,11 +0,0 @@
using System;
namespace DbDataManager.Mapper
{
public class GameMapper
{
public GameMapper()
{
}
}
}

@ -1,11 +0,0 @@
using System;
namespace DbDataManager.Mapper
{
public class GameModeMapper
{
public GameModeMapper()
{
}
}
}

@ -1,11 +0,0 @@
using System;
namespace DbDataManager.Mapper
{
public class GrilleMapper
{
public GrilleMapper()
{
}
}
}

@ -1,14 +0,0 @@
using System;
using EntityFrameWorkLib;
using Model;
namespace DbDataManager.Mapper
{
public static class PlayerMapper
{
public static Player ToPoco(this PlayerEntity player)
{
return new Player(player.Pseudo, new Stats { player.NbWin, player.NbPlayed, player.MaxChain, player.MaxZone, player.MaxPoints }, player.PlayerId);
}
}
}

@ -1,11 +0,0 @@
using System;
namespace DbDataManager.Mapper
{
public class StatsMapper
{
public StatsMapper()
{
}
}
}

@ -1,11 +0,0 @@
using System;
namespace DbDataManager.Mapper
{
public class TurnMapper
{
public TurnMapper()
{
}
}
}

@ -1,78 +0,0 @@
using System;
using EntityFrameWorkLib;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Model;
namespace DbDataManager
{
public class PlayerManager: IPlayersManager
{
private TrekContext trekContext;
public async Task<Player?> AddItem(Player? item)
{
if (item == null)
{
return null;
}
var addItem = await trekContext.AddAsync<Player>(item);
await trekContext.SaveChangesAsync();
return addItem.Entity;
}
public async Task<bool> DeleteItem(Player? item)
{
if (item == null)
{
return false;
}
var deleteItem = trekContext.Remove<Player>(item);
trekContext.SaveChanges();
return true;
}
public async Task<IEnumerable<Player?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
//IEnumerable<Player> players = trekContext.Players.Skip(index * count)
// .Take(count)
// .OrderBy(champions => orderingPropertyName)
// .Select(champions => champions.ToPoco());
//return players;
throw new NotImplementedException();
}
private Func<Player, string, bool> filterByPseudo = (player, substring) => player.Pseudo.Contains(substring, StringComparison.InvariantCultureIgnoreCase);
private Func<Player, int, bool> filterById = (player, id) => player.Id.Equals(id);
public async Task<IEnumerable<Player?>> GetItemsById(int id)
{
//return trekContext.Players.GetItemsWithFilterAndOrdering<Player>(player => filterById(player, id), 0, 1);
throw new NotImplementedException();
}
public Task<IEnumerable<Player?>> GetItemsByPseudo(string charPseudo)
{
//return trekContext.Players.GetItemsWithFilterAndOrdering<Player>(player => filterByPseudo(player, charPseudo), 0, trekContext.Players.Count());
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
return Task.FromResult(trekContext.Players.Count());
}
public Task<int> GetNbItemsByPseudo(string charPseudo)
{
throw new NotImplementedException();
}
public Task<Player?> UpdateItem(Player? oldItem, Player? newItem)
{
//return trekContext.Players.UpdateItem(oldItem, newItem);
throw new NotImplementedException();
}
}
}

@ -1,33 +0,0 @@
using System;
using Model;
namespace DbDataManager
{
public class StatsManager : IStatsManager
{
public Task<Stats?> AddItem(Stats? item)
{
throw new NotImplementedException();
}
public Task<bool> DeleteItem(Stats? item)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Stats?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public Task<Stats?> UpdateItem(Stats? oldItem, Stats? newItem)
{
throw new NotImplementedException();
}
}
}

@ -1,33 +0,0 @@
using System;
using Model;
namespace DbDataManager
{
public class TurnManager : ITurnsManager
{
public Task<Turn?> AddItem(Turn? item)
{
throw new NotImplementedException();
}
public Task<bool> DeleteItem(Turn? item)
{
throw new NotImplementedException();
}
public Task<IEnumerable<Turn?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
throw new NotImplementedException();
}
public Task<int> GetNbItems()
{
throw new NotImplementedException();
}
public Task<Turn?> UpdateItem(Turn? oldItem, Turn? newItem)
{
throw new NotImplementedException();
}
}
}

@ -26,7 +26,7 @@ namespace Model
public Case()
{
Valeur = 0;
}
public Case(int valeur)

@ -13,7 +13,7 @@ namespace Model
public TimeSpan Duration { get; set; }
public DateOnly Date { get; set; }
public DateTime Date { get; set; }
public ReadOnlyCollection<Player> Players { get; private set; }
private List<Player> players;
@ -22,10 +22,10 @@ namespace Model
private List<Turn> turns;
public ReadOnlyDictionary<Player, Grille> Grilles { get; private set; }
private readonly Dictionary<Player, Grille> grilles;
private Dictionary<Player, Grille> grilles;
public ReadOnlyDictionary<Player, int> Scores { get; private set; }
private readonly Dictionary<Player, int> scores;
private Dictionary<Player, int> scores;
public GameMode GameMode { get; set; }
@ -42,25 +42,39 @@ namespace Model
// Id = id;
//}
public Game(DateOnly date, Player ?owner, GameMode gameMode, int id = 0)
public Game(Player ?owner, GameMode gameMode, int id = 0)
{
Date = date;
Date = DateTime.Now;
// Creation list de player + ajout d'une player owner dans la liste
players = new();
turns = new();
grilles = new Dictionary<Player, Grille>();
scores = new Dictionary<Player, int>();
Players = new ReadOnlyCollection<Player>(players);
Grilles = new ReadOnlyDictionary<Player, Grille>(grilles);
Scores = new ReadOnlyDictionary<Player, int>(scores);
players.Add(owner);
turns = new();
Turns = new ReadOnlyCollection<Turn>(turns);
Grilles = new ReadOnlyDictionary<Player, Grille>(new Dictionary<Player, Grille>());
grilles ??= new Dictionary<Player, Grille>();
grilles.Add(owner, new Grille());
Scores = new ReadOnlyDictionary<Player, int>(new Dictionary<Player, int>());
scores ??= new Dictionary<Player, int>();
scores.Add(owner, 0);
players.Add(owner);
GameMode = gameMode;
Id = id;
}
public Game(int id, TimeSpan duration, DateOnly date, List<Player> players, List<Turn> turns, Dictionary<Player, Grille> grilles, Dictionary<Player, int> scores, GameMode gameMode)
public Game(int id, ReadOnlyCollection<Player> players, GameMode gameMode)
{
Id = id;
GameMode = gameMode;
}
public Game(int id, TimeSpan duration, DateTime date, List<Player> players, List<Turn> turns, Dictionary<Player, Grille> grilles, Dictionary<Player, int> scores, GameMode gameMode)
{
Id = id;
Duration = duration;

@ -24,9 +24,11 @@ namespace Model
}
private string name = "";
public GameMode(int id =0)
public GameMode(int id= 0,string name = "Classique")
{
this.Id = id;
this.Name = name;
}
}
}

@ -1,5 +1,5 @@
namespace Model;
public class Player : IEquatable<Player>
public class Player : IEquatable<Player>
{
public int Id { get; set; }
@ -26,6 +26,13 @@
Stats = new Stats();
}
public Player(string pseudo, int id)
{
Pseudo = pseudo;
Id = id;
Stats = new Stats();
}
public Player(string pseudo, Stats stats, int id=0)
{
Pseudo = pseudo;

@ -13,12 +13,10 @@ namespace Stub
{
private List<Game> games = new()
{
new Game(new DateOnly(2023,06,03), new Player("test1"),new GameMode()),
new Game(new DateOnly(2023,06,03), new Player("test2"),new GameMode()),
new Game(new DateOnly(2023,06,03), new Player("test3"),new GameMode()),
new Game(new DateOnly(2023,06,03), new Player("test4"),new GameMode()),
new Game(new DateOnly(2023,06,03), new Player("test5"),new GameMode()),
new Game(new Player("Aurélien",0),new GameMode(),1),
new Game(new Player("Maxence",1),new GameMode(),2),
new Game(new Player("Théo",2),new GameMode(),3),
new Game(new Player("Zakariya",3),new GameMode(),4),
};
public class GamesManager : IGamesManager

@ -12,10 +12,10 @@ namespace Stub
{
private List<Player> players = new()
{
new Player("Aurelien"),
new Player("Theo"),
new Player("Maxence"),
new Player("Zakariya"),
new Player("Aurelien", 0),
new Player("Theo",1),
new Player("Maxence",2),
new Player("Zakariya",3),
};
public class PlayersManager : IPlayersManager

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\Model\Model.csproj" />
<ProjectReference Include="..\..\Stub\Stub\Stub.csproj" />
<ProjectReference Include="..\..\Trek12_Lib\EntityFrameWorkLib.csproj" />
</ItemGroup>
<ItemGroup>

@ -1,175 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DbConsole.Migrations
{
[DbContext(typeof(SQLiteContext))]
[Migration("20230320170448_AllMigrations")]
partial class AllMigrations
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("EntityFrameWorkLib.CaseEntity", b =>
{
b.Property<int>("CaseId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Value")
.HasColumnType("INTEGER");
b.HasKey("CaseId");
b.ToTable("Case");
});
modelBuilder.Entity("EntityFrameWorkLib.GameEntity", b =>
{
b.Property<int>("GameId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateOnly>("Date")
.HasColumnType("TEXT");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("NbPlayers")
.HasColumnType("INTEGER");
b.HasKey("GameId");
b.ToTable("Game");
});
modelBuilder.Entity("EntityFrameWorkLib.GrilleEntity", b =>
{
b.Property<int>("GrilleId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("MaxChain")
.HasColumnType("INTEGER");
b.Property<int>("MaxZone")
.HasColumnType("INTEGER");
b.Property<int>("NbChains")
.HasColumnType("INTEGER");
b.Property<int>("NbZones")
.HasColumnType("INTEGER");
b.HasKey("GrilleId");
b.ToTable("Grille");
});
modelBuilder.Entity("EntityFrameWorkLib.PlayerEntity", b =>
{
b.Property<int>("PlayerId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("MaxPoints")
.HasColumnType("INTEGER");
b.Property<int>("MaxZone")
.HasColumnType("INTEGER");
b.Property<int>("NbPlayed")
.HasColumnType("INTEGER");
b.Property<int>("NbPoints")
.HasColumnType("INTEGER");
b.Property<int>("NbWin")
.HasColumnType("INTEGER");
b.Property<string>("Pseudo")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PlayerId");
b.ToTable("Players");
});
modelBuilder.Entity("EntityFrameWorkLib.ScoreEntity", b =>
{
b.Property<int>("ScoreId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("GameId")
.HasColumnType("INTEGER");
b.Property<int>("NbPoints")
.HasColumnType("INTEGER");
b.Property<int>("PlayerId")
.HasColumnType("INTEGER");
b.HasKey("ScoreId");
b.HasIndex("GameId");
b.HasIndex("PlayerId");
b.ToTable("Score");
});
modelBuilder.Entity("EntityFrameWorkLib.TurnEntity", b =>
{
b.Property<int>("TurnId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("DiceValue1")
.HasColumnType("INTEGER");
b.Property<int>("DiceValue2")
.HasColumnType("INTEGER");
b.HasKey("TurnId");
b.ToTable("Turn");
});
modelBuilder.Entity("EntityFrameWorkLib.ScoreEntity", b =>
{
b.HasOne("EntityFrameWorkLib.GameEntity", "Game")
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFrameWorkLib.PlayerEntity", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Game");
b.Navigation("Player");
});
#pragma warning restore 612, 618
}
}
}

@ -1,151 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DbConsole.Migrations
{
/// <inheritdoc />
public partial class AllMigrations : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Case",
columns: table => new
{
CaseId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Value = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Case", x => x.CaseId);
});
migrationBuilder.CreateTable(
name: "Game",
columns: table => new
{
GameId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Duration = table.Column<TimeSpan>(type: "TEXT", nullable: false),
Date = table.Column<DateOnly>(type: "TEXT", nullable: false),
NbPlayers = table.Column<int>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Game", x => x.GameId);
});
migrationBuilder.CreateTable(
name: "Grille",
columns: table => new
{
GrilleId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
NbChains = table.Column<int>(type: "INTEGER", nullable: false),
NbZones = table.Column<int>(type: "INTEGER", nullable: false),
MaxChain = table.Column<int>(type: "INTEGER", nullable: false),
MaxZone = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Grille", x => x.GrilleId);
});
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
PlayerId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Pseudo = table.Column<string>(type: "TEXT", nullable: false),
NbWin = table.Column<int>(type: "INTEGER", nullable: false),
NbPlayed = table.Column<int>(type: "INTEGER", nullable: false),
MaxZone = table.Column<int>(type: "INTEGER", nullable: false),
MaxPoints = table.Column<int>(type: "INTEGER", nullable: false),
NbPoints = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.PlayerId);
});
migrationBuilder.CreateTable(
name: "Turn",
columns: table => new
{
TurnId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DiceValue1 = table.Column<int>(type: "INTEGER", nullable: false),
DiceValue2 = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Turn", x => x.TurnId);
});
migrationBuilder.CreateTable(
name: "Score",
columns: table => new
{
ScoreId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
NbPoints = table.Column<int>(type: "INTEGER", nullable: false),
GameId = table.Column<int>(type: "INTEGER", nullable: false),
PlayerId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Score", x => x.ScoreId);
table.ForeignKey(
name: "FK_Score_Game_GameId",
column: x => x.GameId,
principalTable: "Game",
principalColumn: "GameId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Score_Players_PlayerId",
column: x => x.PlayerId,
principalTable: "Players",
principalColumn: "PlayerId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Score_GameId",
table: "Score",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_Score_PlayerId",
table: "Score",
column: "PlayerId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Case");
migrationBuilder.DropTable(
name: "Grille");
migrationBuilder.DropTable(
name: "Score");
migrationBuilder.DropTable(
name: "Turn");
migrationBuilder.DropTable(
name: "Game");
migrationBuilder.DropTable(
name: "Players");
}
}
}

@ -1,172 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace DbConsole.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("EntityFrameWorkLib.CaseEntity", b =>
{
b.Property<int>("CaseId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Value")
.HasColumnType("INTEGER");
b.HasKey("CaseId");
b.ToTable("Case");
});
modelBuilder.Entity("EntityFrameWorkLib.GameEntity", b =>
{
b.Property<int>("GameId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateOnly>("Date")
.HasColumnType("TEXT");
b.Property<TimeSpan>("Duration")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("NbPlayers")
.HasColumnType("INTEGER");
b.HasKey("GameId");
b.ToTable("Game");
});
modelBuilder.Entity("EntityFrameWorkLib.GrilleEntity", b =>
{
b.Property<int>("GrilleId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("MaxChain")
.HasColumnType("INTEGER");
b.Property<int>("MaxZone")
.HasColumnType("INTEGER");
b.Property<int>("NbChains")
.HasColumnType("INTEGER");
b.Property<int>("NbZones")
.HasColumnType("INTEGER");
b.HasKey("GrilleId");
b.ToTable("Grille");
});
modelBuilder.Entity("EntityFrameWorkLib.PlayerEntity", b =>
{
b.Property<int>("PlayerId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("MaxPoints")
.HasColumnType("INTEGER");
b.Property<int>("MaxZone")
.HasColumnType("INTEGER");
b.Property<int>("NbPlayed")
.HasColumnType("INTEGER");
b.Property<int>("NbPoints")
.HasColumnType("INTEGER");
b.Property<int>("NbWin")
.HasColumnType("INTEGER");
b.Property<string>("Pseudo")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("PlayerId");
b.ToTable("Players");
});
modelBuilder.Entity("EntityFrameWorkLib.ScoreEntity", b =>
{
b.Property<int>("ScoreId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("GameId")
.HasColumnType("INTEGER");
b.Property<int>("NbPoints")
.HasColumnType("INTEGER");
b.Property<int>("PlayerId")
.HasColumnType("INTEGER");
b.HasKey("ScoreId");
b.HasIndex("GameId");
b.HasIndex("PlayerId");
b.ToTable("Score");
});
modelBuilder.Entity("EntityFrameWorkLib.TurnEntity", b =>
{
b.Property<int>("TurnId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("DiceValue1")
.HasColumnType("INTEGER");
b.Property<int>("DiceValue2")
.HasColumnType("INTEGER");
b.HasKey("TurnId");
b.ToTable("Turn");
});
modelBuilder.Entity("EntityFrameWorkLib.ScoreEntity", b =>
{
b.HasOne("EntityFrameWorkLib.GameEntity", "Game")
.WithMany()
.HasForeignKey("GameId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFrameWorkLib.PlayerEntity", "Player")
.WithMany()
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Game");
b.Navigation("Player");
});
#pragma warning restore 612, 618
}
}
}

@ -1,34 +1,25 @@
using EntityFrameWorkLib;
using Microsoft.EntityFrameworkCore;
using Model;
using Stub;
PlayerEntity p1 = new PlayerEntity
{
PlayerId = 0,
Pseudo = "Jax",
NbWin = 0,
NbPlayed = 0,
MaxZone = 0,
MaxPoints = 0,
NbPoints = 0
};
GameEntity g1 = new GameEntity
/*GameEntity g1 = new GameEntity
{
GameId = 1,
};
};*/
PlayerEntity p2 = new PlayerEntity
/*PlayerEntity p1 = new PlayerEntity
{
PlayerId = 0,
Pseudo = "Theo",
PlayerId = 1,
Pseudo = "Jax",
NbWin = 0,
NbPlayed = 0,
MaxZone = 0,
MaxPoints = 0,
NbPoints = 0
};
};*/
/*using (var context = new SQLiteContext())
/*using (var context = new TrekContext())
{
Console.WriteLine("Create and Insert new Player");
context.Add(p1);
@ -36,26 +27,89 @@ PlayerEntity p2 = new PlayerEntity
context.SaveChanges();
}*/
using (var context = new SQLiteContext())
// Ajout de 3 Game, 1 Player "Jax" et 3 Scores totaux dans chaque Game attribués au Player par son Id
/*using (var context = new TrekContext())
{
var newScore = new ScoreEntity
var firstGame = new GameEntity
{
GameId = 1,
Name = "First Game",
};
var secondGame = new GameEntity
{
GameId = 2,
Name = "Second Game",
};
var thirdGame = new GameEntity
{
GameId = 3,
Name = "Third Game",
};
var newPlayer = new PlayerEntity
{
PlayerId = 2,
NbPoints = 5
Pseudo = "Jax"
};
var scores = new List<ScoreEntity>
{
new ScoreEntity { GameId = 1, NbPointsTotal = 5 },
new ScoreEntity { GameId = 2, NbPointsTotal = 10 },
new ScoreEntity { GameId = 3, NbPointsTotal = 15 }
};
newPlayer.Scores = scores;
context.AddRange(firstGame, secondGame, thirdGame, newPlayer);
context.AddRange(scores);
context.SaveChanges();
}*/
/*using(var context = new TrekContext())
{
var grille = new GrilleEntity
{
GrilleId = 1,
NbChains = 1,
NbZones = 4,
MaxChain = 20,
MaxZone = 25
};
context.Add(newScore);
var case1 = new CaseEntity
{
CaseId = 1,
Value = 5,
GrilleId = 1
};
var case2 = new CaseEntity
{
CaseId = 2,
Value = 10,
GrilleId = 1
};
var case3 = new CaseEntity
{
CaseId = 3,
Value = 12,
GrilleId = 1
};
context.AddRange(grille, case1, case2, case3);
context.SaveChanges();
}
*/
public class SQLiteContext : TrekContext
using (var context = new TrekContext())
{
protected override void OnConfiguring(DbContextOptionsBuilder options)
var grille = new GrilleEntity
{
if (!options.IsConfigured)
GrilleId = 1,
Cases = new List<CaseEntity>
{
options.UseSqlite($"Data Source=projet.ToutesTables.db");
new CaseEntity { CaseId = 1, GrilleId = 1, Value = 2 },
new CaseEntity { CaseId = 2, GrilleId = 1, Value = 5 },
new CaseEntity { CaseId = 3, GrilleId = 1, Value = 10 },
new CaseEntity { CaseId = 4, GrilleId = 1, Value = 12 },
new CaseEntity { CaseId = 5, GrilleId = 1, Value = 7 }
}
}
};
context.Add(grille);
context.SaveChanges();
}

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="GetEFProjectMetadata">
<MSBuild Condition=" '$(TargetFramework)' == '' "
Projects="$(MSBuildProjectFile)"
Targets="GetEFProjectMetadata"
Properties="TargetFramework=$(TargetFrameworks.Split(';')[0]);EFProjectMetadataFile=$(EFProjectMetadataFile)" />
<ItemGroup Condition=" '$(TargetFramework)' != '' ">
<EFProjectMetadata Include="AssemblyName: $(AssemblyName)" />
<EFProjectMetadata Include="Language: $(Language)" />
<EFProjectMetadata Include="OutputPath: $(OutputPath)" />
<EFProjectMetadata Include="Platform: $(Platform)" />
<EFProjectMetadata Include="PlatformTarget: $(PlatformTarget)" />
<EFProjectMetadata Include="ProjectAssetsFile: $(ProjectAssetsFile)" />
<EFProjectMetadata Include="ProjectDir: $(ProjectDir)" />
<EFProjectMetadata Include="RootNamespace: $(RootNamespace)" />
<EFProjectMetadata Include="RuntimeFrameworkVersion: $(RuntimeFrameworkVersion)" />
<EFProjectMetadata Include="TargetFileName: $(TargetFileName)" />
<EFProjectMetadata Include="TargetFrameworkMoniker: $(TargetFrameworkMoniker)" />
<EFProjectMetadata Include="Nullable: $(Nullable)" />
<EFProjectMetadata Include="TargetFramework: $(TargetFramework)" />
<EFProjectMetadata Include="TargetPlatformIdentifier: $(TargetPlatformIdentifier)" />
</ItemGroup>
<WriteLinesToFile Condition=" '$(TargetFramework)' != '' "
File="$(EFProjectMetadataFile)"
Lines="@(EFProjectMetadata)" />
</Target>
</Project>

@ -9,7 +9,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@ -21,4 +24,9 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Stub\Stub\Stub.csproj" />
<ProjectReference Include="..\..\Trek12_Lib\EntityFrameWorkLib.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,22 @@
using EntityFrameWorkLib;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Model;
using NUnit.Framework.Internal;
using Stub;
using System.Data;
using static Stub.StubData;
namespace ModelTest
{
public class Test_Stub
{
[Fact]
public void Test_AddNewPlayer()
{
Player player = new Player("Jax");
GameMode gameMode = new GameMode();
Game game = new Game(player, gameMode, 1);
}
}
}

@ -1,11 +0,0 @@
namespace ModelTest
{
public class UnitTest1
{
[Fact]
public void Test1()
{
}
}
}

@ -0,0 +1,41 @@
using System;
using Model;
namespace Test_Model
{
public class TestGame
{
public static IEnumerable<object[]> GameData_init()
{
yield return new object[]
{
true,
new Player[]
{
new Player("Player 1",2)
},
new Game(new Player("Player1",2),new GameMode(1,"Classique")),
new Player("Player1",2)
};
}
[Theory]
[MemberData(nameof(GameData_init))]
public void AddPlayerToGame_Should_Return_Correct_Result(bool expectedResult,
IEnumerable<Player> expectedPlayers,
Game game,
Player playerToBeAdded)
{
// Act
bool result = game.AddPlayerToGame(playerToBeAdded);
Console.WriteLine(result);
// Assert
Assert.Equal(expectedResult, result);
Assert.Equal(expectedPlayers.Count(), game.Players.Count());
Assert.All(expectedPlayers, p => game.Players.Contains(p));
}
}
}

@ -0,0 +1,152 @@
using Model;
namespace Test_Model;
public class TestPlayer
{
//public static IEnumerable<object[]> PlayerData =>
// new List<object[]>
// {
// new object[] { new Player("Alice", new Stats { NbWin = 2, NbPlayed = 5, MaxChain = 3, MaxZone = 10, MaxPoints = 200 }), true },
// new object[] { new Player("Bob", new Stats { NbWin = 1, NbPlayed = 2, MaxChain = 2, MaxZone = 5, MaxPoints = 100 }), true },
// new object[] { new Player("Alice", new Stats { NbWin = 1, NbPlayed = 3, MaxChain = 4, MaxZone = 12, MaxPoints = 150 }), true },
// new object[] { new Player(null), false },
// new object[] { new Player("Charlie"), false }
// };
//[Theory]
//[MemberData(nameof(PlayerData))]
//public void TestEquals(Player p1, bool expected)
//{
// var p2 = new Player(p1.Pseudo, p1.Stats, p1.Id);
// Assert.Equal(expected, p1.Equals(p2));
//}
[Theory]
[InlineData("Alice", 2, 5, 3, 10, 200)]
[InlineData("Bob", 1, 2, 2, 5, 100)]
[InlineData("Charlie", 0, 0, 0, 0, 0)]
public void TestConstructorWithStats(string pseudo, int nbWin, int nbPlayed, int maxChain, int maxZone, int maxPoints)
{
var stats = new Stats { NbWin = nbWin, NbPlayed = nbPlayed, MaxChain = maxChain, MaxZone = maxZone, MaxPoints = maxPoints };
var player = new Player(pseudo, stats);
Assert.Equal(pseudo, player.Pseudo);
Assert.Equal(0, player.Id);
Assert.Equal(nbWin, player.Stats.NbWin);
Assert.Equal(nbPlayed, player.Stats.NbPlayed);
Assert.Equal(maxChain, player.Stats.MaxChain);
Assert.Equal(maxZone, player.Stats.MaxZone);
Assert.Equal(maxPoints, player.Stats.MaxPoints);
}
[Fact]
public void TestAddWin()
{
var player = new Player("Alice");
player.AddWin();
player.AddWin();
player.AddWin();
Assert.Equal(3, player.Stats.NbWin);
}
[Fact]
public void TestAddPlayed()
{
var player = new Player("Alice");
player.AddPlayed();
player.AddPlayed();
Assert.Equal(2, player.Stats.NbPlayed);
}
[Theory]
[InlineData("John")]
[InlineData("Jane")]
[InlineData("Jake")]
public void AddWin_ShouldIncrementNbWinByOne(string pseudo)
{
// Arrange
var player = new Player(pseudo);
var initialNbWin = player.Stats.NbWin;
// Act
player.AddWin();
// Assert
Assert.Equal(initialNbWin + 1, player.Stats.NbWin);
}
[Theory]
[InlineData("John")]
[InlineData("Jane")]
[InlineData("Jake")]
public void AddPlayed_ShouldIncrementNbPlayedByOne(string pseudo)
{
// Arrange
var player = new Player(pseudo);
var initialNbPlayed = player.Stats.NbPlayed;
// Act
player.AddPlayed();
// Assert
Assert.Equal(initialNbPlayed + 1, player.Stats.NbPlayed);
}
[Theory]
[InlineData("John", 10)]
[InlineData("Jane", 5)]
[InlineData("Jake", 7)]
public void AddMaxChain_ShouldSetMaxChain(string pseudo, int maxChain)
{
// Arrange
var player = new Player(pseudo);
var initialMaxChain = player.Stats.MaxChain;
// Act
player.AddMaxChain(maxChain);
// Assert
Assert.Equal(maxChain, player.Stats.MaxChain);
Assert.NotEqual(initialMaxChain, player.Stats.MaxChain);
}
[Theory]
[InlineData("John", 5)]
[InlineData("Jane", 8)]
[InlineData("Jake", 12)]
public void AddMaxZone_ShouldSetMaxZone(string pseudo, int maxZone)
{
// Arrange
var player = new Player(pseudo);
var initialMaxZone = player.Stats.MaxZone;
// Act
player.AddMaxZone(maxZone);
// Assert
Assert.Equal(maxZone, player.Stats.MaxZone);
Assert.NotEqual(initialMaxZone, player.Stats.MaxZone);
}
[Theory]
[InlineData("John", 100)]
[InlineData("Jane", 50)]
[InlineData("Jake", 75)]
public void AddMaxPoints_ShouldSetMaxPoints(string pseudo, int maxPoints)
{
// Arrange
var player = new Player(pseudo);
var initialMaxPoints = player.Stats.MaxPoints;
// Act
player.AddMaxPoints(maxPoints);
// Assert
Assert.Equal(maxPoints, player.Stats.MaxPoints);
Assert.NotEqual(initialMaxPoints, player.Stats.MaxPoints);
}
}

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1 @@
global using Xunit;

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Stub\Stub\Stub.csproj" />
<ProjectReference Include="..\..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,117 @@
using System.Numerics;
using Model;
using Stub;
namespace Test_Stub;
public class Test_Stub_Games
{
public static IEnumerable<object[]> GetGameAndPlayerIds()
{
yield return new object[] { 1, 0 };
yield return new object[] { 2, 1 };
yield return new object[] { 3, 2 };
yield return new object[] { 4, 3 };
}
public static IEnumerable<object[]> GetInvalidGameAndPlayerIds()
{
yield return new object[] { -1, 0 };
yield return new object[] { 1, -1 };
yield return new object[] { 5, 0 };
yield return new object[] { 1, 4 };
}
//[Theory]
//[MemberData(nameof(GetGameAndPlayerIds))]
//public async Task AddScoreToPlayer_ValidIds_ReturnsTrue(int gameId, int playerId)
//{
// // Arrange
// var stubData = new StubData();
// var manager = new StubData.GamesManager(stubData);
// // Act
// var result = await manager.AddScoreToPlayer(gameId, playerId, 10);
// // Assert
// Assert.True(result);
//}
[Theory]
[MemberData(nameof(GetInvalidGameAndPlayerIds))]
public async Task AddScoreToPlayer_InvalidIds_ReturnsFalse(int gameId, int playerId)
{
// Arrange
var stubData = new StubData();
var manager = new StubData.GamesManager(stubData);
// Act
var result = await manager.AddScoreToPlayer(gameId, playerId, 10);
// Assert
Assert.False(result);
}
//[Fact]
//public async Task AddPlayer_ValidPlayer_ReturnsTrue()
//{
// // Arrange
// var stubData = new StubData();
// var manager = new StubData.GamesManager(stubData);
// var player = new Player("John", 4);
// // Act
// var result = await manager.AddPlayer(player);
// // Assert
// Assert.True(result);
//}
//[Fact]
//public async Task AddPlayer_InvalidGame_ReturnsFalse()
//{
// // Arrange
// var stubData = new StubData();
// var manager = new StubData.GamesManager(stubData);
// var player = new Player("John", 4);
// // Act
// var result = await manager.AddPlayer(player);
// // Assert
// Assert.True(result);
//}
[Fact]
public async Task GetItems_ReturnsCorrectCount()
{
// Arrange
var stubData = new StubData();
var manager = new StubData.GamesManager(stubData);
// Act
var items = await manager.GetItems(0, 3, null);
// Assert
Assert.Equal(3, items.Count());
}
[Theory]
[InlineData(1)]
[InlineData(2)]
[InlineData(3)]
[InlineData(4)]
public async Task GetItemsById_ReturnsCorrectItem(int id)
{
// Arrange
var stubData = new StubData();
var manager = new StubData.GamesManager(stubData);
// Act
var items = await manager.GetItemsById(id);
// Assert
Assert.Single(items);
Assert.Equal(id, items.First()?.Id);
}
}

@ -0,0 +1 @@
global using Xunit;

@ -13,19 +13,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameWorkLib", "Trek1
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DbConsole", "Tests\DbConsole\DbConsole.csproj", "{75B303CC-F36E-46FA-BE23-05EEA35D9B28}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModelTest", "Tests\ModelTest\ModelTest.csproj", "{6EC6383D-10E8-44E1-8EDD-EF4DF460A9B1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ModelTest", "Tests\ModelTest\ModelTest.csproj", "{6EC6383D-10E8-44E1-8EDD-EF4DF460A9B1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Stub", "Stub", "{B1585816-FCBB-484F-A1AA-C7AEB501C39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stub", "Stub\Stub\Stub.csproj", "{5E45E953-4FCC-42B6-9F22-15108D002D78}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stub", "Stub\Stub\Stub.csproj", "{5E45E953-4FCC-42B6-9F22-15108D002D78}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{8B6EC777-57F8-4509-9163-4312A40FE63C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csproj", "{8B6EC777-57F8-4509-9163-4312A40FE63C}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7DF17583-2166-4ABE-82EE-F63CEE2132C2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Stub", "Tests\Test_Stub\Test_Stub.csproj", "{5A1D87FF-E82F-43FF-AC5C-59659B91D5B8}"
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "DbDataManager", "..\DbDataManager\DbDataManager.csproj", "{BE8F0B15-4DBA-48FD-867C-E67CE4499911}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbDataManager", "DbDataManager\DbDataManager.csproj", "{DE7D7164-A19D-4F41-A8E3-B4D1891F6EA0}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_Model", "Tests\Test_Model\Test_Model.csproj", "{593766AA-8E2A-4B3D-A299-8E45F5C19C18}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -61,18 +59,14 @@ Global
{8B6EC777-57F8-4509-9163-4312A40FE63C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B6EC777-57F8-4509-9163-4312A40FE63C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B6EC777-57F8-4509-9163-4312A40FE63C}.Release|Any CPU.Build.0 = Release|Any CPU
{7DF17583-2166-4ABE-82EE-F63CEE2132C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DF17583-2166-4ABE-82EE-F63CEE2132C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DF17583-2166-4ABE-82EE-F63CEE2132C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DF17583-2166-4ABE-82EE-F63CEE2132C2}.Release|Any CPU.Build.0 = Release|Any CPU
{BE8F0B15-4DBA-48FD-867C-E67CE4499911}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE8F0B15-4DBA-48FD-867C-E67CE4499911}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE8F0B15-4DBA-48FD-867C-E67CE4499911}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE8F0B15-4DBA-48FD-867C-E67CE4499911}.Release|Any CPU.Build.0 = Release|Any CPU
{DE7D7164-A19D-4F41-A8E3-B4D1891F6EA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE7D7164-A19D-4F41-A8E3-B4D1891F6EA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE7D7164-A19D-4F41-A8E3-B4D1891F6EA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE7D7164-A19D-4F41-A8E3-B4D1891F6EA0}.Release|Any CPU.Build.0 = Release|Any CPU
{5A1D87FF-E82F-43FF-AC5C-59659B91D5B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A1D87FF-E82F-43FF-AC5C-59659B91D5B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A1D87FF-E82F-43FF-AC5C-59659B91D5B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A1D87FF-E82F-43FF-AC5C-59659B91D5B8}.Release|Any CPU.Build.0 = Release|Any CPU
{593766AA-8E2A-4B3D-A299-8E45F5C19C18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{593766AA-8E2A-4B3D-A299-8E45F5C19C18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{593766AA-8E2A-4B3D-A299-8E45F5C19C18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{593766AA-8E2A-4B3D-A299-8E45F5C19C18}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -81,6 +75,8 @@ Global
{75B303CC-F36E-46FA-BE23-05EEA35D9B28} = {C75DF644-C41F-4A08-8B69-C8554204AC72}
{6EC6383D-10E8-44E1-8EDD-EF4DF460A9B1} = {C75DF644-C41F-4A08-8B69-C8554204AC72}
{5E45E953-4FCC-42B6-9F22-15108D002D78} = {B1585816-FCBB-484F-A1AA-C7AEB501C39B}
{5A1D87FF-E82F-43FF-AC5C-59659B91D5B8} = {C75DF644-C41F-4A08-8B69-C8554204AC72}
{593766AA-8E2A-4B3D-A299-8E45F5C19C18} = {C75DF644-C41F-4A08-8B69-C8554204AC72}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4D47853B-D1A3-49A5-84BA-CD2DC65FD105}

@ -11,7 +11,7 @@ namespace Trek12_API.Controllers
public class GameController: ControllerBase
{
private readonly ILogger<GameController> _logger;
private StubData.GamesManager gamesManager { get; set; } = new StubData.GamesManager(new StubData());
private GamesManager gamesManager { get; set; } = new StubData.GamesManager(new StubData());
public GameController(ILogger<GameController> logger)
@ -65,7 +65,7 @@ namespace Trek12_API.Controllers
return Ok("Partie bien supprimée");
}
/* [HttpPut(Name = "UpdateGameById")]
/*[HttpPut(Name = "UpdateGameById")]
public async Task<IActionResult> Update(int id, GameDTO newGame)
{
await gamesManager.UpdateItem(gamesManager.GetItemsById(id).Result.FirstOrDefault(), newGame.toModel());

@ -54,7 +54,7 @@ namespace Trek12_API.Controllers
return Ok(player?.toDTOs());
}
[HttpPost]
[HttpPost(Name= "AddPlayer")]
public async Task<IActionResult> Post(PlayerDTO player)
{
Player playerToCreate = player.toModel();

@ -1,4 +1,5 @@
using Model;
using System.Text.Json.Serialization;
using Model;
using Trek12_API.DTO;
namespace Trek12_API.Converter

@ -7,7 +7,7 @@ namespace Trek12_API.DTO
{
public int Id { get; set; }
public TimeSpan Duration { get; set; }
public DateOnly Date { get; set; }
public DateTime Date { get; set; }
public List<TurnDTO> Turns { get; set; }
public Dictionary<PlayerDTO, GrilleDTO> Grilles { get; set; }
public Dictionary<PlayerDTO, int> Scores { get; set; }

@ -0,0 +1,23 @@
using System;
using System.Collections.ObjectModel;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Trek12_API.JsonConverter
{
public class ReadOnlyDictionnaryConverter<TKey,TValue>: JsonConverter<ReadOnlyDictionary<TKey,TValue>>
{
public override ReadOnlyDictionary<TKey, TValue>? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
Dictionary<TKey, TValue> dictionary = JsonSerializer.Deserialize<Dictionary<TKey, TValue>>(ref reader, options);
return new ReadOnlyDictionary<TKey, TValue>(dictionary);
}
public override void Write(Utf8JsonWriter writer, ReadOnlyDictionary<TKey, TValue> value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value.ToDictionary(kv => kv.Key, kv => kv.Value),options);
}
}
}

@ -1,12 +1,20 @@
var builder = WebApplication.CreateBuilder(args);
using Model;
using Trek12_API.JsonConverter;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new ReadOnlyDictionnaryConverter<Player, Grille>());
options.JsonSerializerOptions.Converters.Add(new ReadOnlyDictionnaryConverter<int, Player>());
});
var app = builder.Build();
// Configure the HTTP request pipeline.

@ -16,4 +16,10 @@
<ProjectReference Include="..\Stub\Stub\Stub.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="JsonConverter\" />
</ItemGroup>
<ItemGroup>
<Folder Include="JsonConverter\" />
</ItemGroup>
</Project>

@ -1,14 +1,22 @@
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 EntityFrameWorkLib
{
public class CaseEntity
{
public class CaseEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int CaseId { get; set; }
[ForeignKey("GrilleId")]
public int GrilleId { get; set; }
public GrilleEntity Grille { get; set; }
public int Value { get; set; }
}
}

@ -16,7 +16,8 @@ namespace EntityFrameWorkLib
public TimeSpan Duration { get; set; }
public DateOnly Date { get; set; }
public int NbPlayers { get; set; }
public string Name { get; set; }
//public ICollection<PlayerEntity> NbPoints { get; set; }
public PlayerEntity Player { get; set; }
public string? Name { get; set; }
public List<ScoreEntity>? Scores { get; set; }
}
}

@ -17,5 +17,6 @@ namespace EntityFrameWorkLib
public int NbZones { get; set; }
public int MaxChain { get; set; }
public int MaxZone { get; set; }
public List<CaseEntity> Cases { get; set; }
}
}

@ -0,0 +1,29 @@
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 EntityFrameWorkLib
{
public class ParticipateEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[ForeignKey("GrilleId")]
public int GrilleId { get; set; }
public GrilleEntity Grille { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[ForeignKey("GameId")]
public int GameId { get; set; }
public GameEntity Game { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[ForeignKey("PlayerId")]
public int PlayerId { get; set; }
public PlayerEntity Player { get; set; }
}
}

@ -9,13 +9,11 @@ namespace EntityFrameWorkLib
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int PlayerId { get; set; }
public string Pseudo { get; set; }
public string? Pseudo { get; set; }
public int NbWin { get; set; }
public int NbPlayed { get; set; }
public int MaxZone { get; set; }
public int MaxChain { get; set; }
public int MaxPoints { get; set; }
public int NbPoints { get; set; }
}
}

@ -10,17 +10,12 @@ namespace EntityFrameWorkLib
{
public class ScoreEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ScoreId { get; set; }
public int NbPoints { get; set; }
public int GameId { get; set; }
public int NbPointsTotal { get; set; }
[ForeignKey("GameId")]
public int GameId { get; set; }
public GameEntity Game { get; set; }
public int PlayerId { get; set; }
[ForeignKey("PlayerId")]
public int PlayerId { get; set; }
public PlayerEntity Player { get; set; }
}
}

@ -45,15 +45,41 @@ namespace EntityFrameWorkLib
modelBuilder.Entity<CaseEntity>().HasKey(n => n.CaseId);
//Définition de la clé primaire de TurnEntity
modelBuilder.Entity<TurnEntity>().HasKey(n => n.TurnId);
//Définition de la clé primaire de ScoreEntity
modelBuilder.Entity<ScoreEntity>().HasKey(n => n.ScoreId);
//Définition du mode de generation de la clé : génération à l'insertion
modelBuilder.Entity<PlayerEntity>().Property(n => n.PlayerId).ValueGeneratedOnAdd();
modelBuilder.Entity<GameEntity>().Property(n => n.GameId).ValueGeneratedOnAdd();
modelBuilder.Entity<GrilleEntity>().Property(n => n.GrilleId).ValueGeneratedOnAdd();
modelBuilder.Entity<CaseEntity>().Property(n => n.CaseId).ValueGeneratedOnAdd();
modelBuilder.Entity<TurnEntity>().Property(n => n.TurnId).ValueGeneratedOnAdd();
modelBuilder.Entity<ScoreEntity>().Property(n => n.ScoreId).ValueGeneratedOnAdd();
//Configuration des clés primaires et étrangères pour la table Score
modelBuilder.Entity<GameEntity>()
.HasKey(g => g.GameId);
modelBuilder.Entity<PlayerEntity>()
.HasKey(p => p.PlayerId);
modelBuilder.Entity<ScoreEntity>()
.HasKey(s => new { s.GameId, s.PlayerId });
modelBuilder.Entity<ScoreEntity>()
.HasOne(s => s.Game)
.WithMany(g => g.Scores)
.HasForeignKey(s => s.GameId);
modelBuilder.Entity<ScoreEntity>()
.HasOne(s => s.Player)
.WithMany()
.HasForeignKey(s => s.PlayerId);
// Configuration de la relation "one-to-many" entre GrilleEntity et CaseEntity
modelBuilder.Entity<GrilleEntity>()
.HasMany(g => g.Cases)
.WithOne(c => c.Grille)
.HasForeignKey(c => c.GrilleId);
//Configuration des clés primaires et étrangères pour la table Participate
base.OnModelCreating(modelBuilder);
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk" DefaultTargets="Build">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>{7DF17583-2166-4ABE-82EE-F63CEE2132C2}</ProjectGuid>
<DockerLaunchBrowser>True</DockerLaunchBrowser>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>trek12_api</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>

@ -0,0 +1,13 @@
version: '3.4'
services:
trek12_api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
ports:
- "80"
- "443"
volumes:
- ~/.aspnet/https:/root/.aspnet/https:ro
- ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro

@ -0,0 +1,8 @@
version: '3.4'
services:
trek12_api:
image: ${DOCKER_REGISTRY-}trek12api
build:
context: .
dockerfile: Trek12_API/Dockerfile

@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk" DefaultTargets="Build">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>{7DF17583-2166-4ABE-82EE-F63CEE2132C2}</ProjectGuid>
<DockerLaunchBrowser>True</DockerLaunchBrowser>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>trek12_api</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>

@ -0,0 +1,13 @@
version: '3.4'
services:
trek12_api:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=https://+:443;http://+:80
ports:
- "80"
- "443"
volumes:
- ~/.aspnet/https:/root/.aspnet/https:ro
- ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro

@ -0,0 +1,8 @@
version: '3.4'
services:
trek12_api:
image: ${DOCKER_REGISTRY-}trek12api
build:
context: .
dockerfile: Trek12_API/Dockerfile
Loading…
Cancel
Save