From 9567423195135a750e0498cb863f75b91c66c974 Mon Sep 17 00:00:00 2001 From: mcmuzzle Date: Mon, 20 May 2024 22:50:42 +0200 Subject: [PATCH] Creation de la solution et de la classe Match --- .editorconfig | 20 +++++++++++++ .gitignore | 3 ++ README.md => README.adoc | 2 +- src/LittleTown.Core.Tests/GlobalUsings.cs | 1 + .../LittleTown.Core.Tests.csproj | 29 +++++++++++++++++++ src/LittleTown.Core.Tests/MatchTesting.cs | 18 ++++++++++++ src/LittleTown.Core/LittleTown.Core.csproj | 14 +++++++++ src/LittleTown.Core/MatchAggregate/Match.cs | 20 +++++++++++++ src/LittleTown.Core/readme.adoc | 4 +++ src/LittleTown.sln | 28 ++++++++++++++++++ 10 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 .editorconfig rename README.md => README.adoc (79%) create mode 100644 src/LittleTown.Core.Tests/GlobalUsings.cs create mode 100644 src/LittleTown.Core.Tests/LittleTown.Core.Tests.csproj create mode 100644 src/LittleTown.Core.Tests/MatchTesting.cs create mode 100644 src/LittleTown.Core/LittleTown.Core.csproj create mode 100644 src/LittleTown.Core/MatchAggregate/Match.cs create mode 100644 src/LittleTown.Core/readme.adoc create mode 100644 src/LittleTown.sln diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..90ac7fb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +#### .NET Coding Conventions #### +# C# files +[*.cs] +dotnet_diagnostic.IDE1006.severity = warning +dotnet_diagnostic.IDE0005.severity = error + +# Exclude generated code +[src/**/Migrations/*.cs] +generated_code = true +dotnet_analyzer_diagnostic.severity = none + +#### Core EditorConfig Options #### +[*] +# Indentation and spacing +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore index 8c2b884..3ee7f61 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ # Built Visual Studio Code Extensions *.vsix +bin +obj + diff --git a/README.md b/README.adoc similarity index 79% rename from README.md rename to README.adoc index a041ad8..0d1b2b2 100644 --- a/README.md +++ b/README.adoc @@ -1,3 +1,3 @@ -# LittleTown += LittleTown Petit projet d'adaptation de littleTown en ligne \ No newline at end of file diff --git a/src/LittleTown.Core.Tests/GlobalUsings.cs b/src/LittleTown.Core.Tests/GlobalUsings.cs new file mode 100644 index 0000000..8c927eb --- /dev/null +++ b/src/LittleTown.Core.Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/src/LittleTown.Core.Tests/LittleTown.Core.Tests.csproj b/src/LittleTown.Core.Tests/LittleTown.Core.Tests.csproj new file mode 100644 index 0000000..12e64a7 --- /dev/null +++ b/src/LittleTown.Core.Tests/LittleTown.Core.Tests.csproj @@ -0,0 +1,29 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/src/LittleTown.Core.Tests/MatchTesting.cs b/src/LittleTown.Core.Tests/MatchTesting.cs new file mode 100644 index 0000000..dc9ed1e --- /dev/null +++ b/src/LittleTown.Core.Tests/MatchTesting.cs @@ -0,0 +1,18 @@ +namespace LittleTown.Core.Tests; + +public class MatchTesting +{ + [Fact] + public void EnforcePlayerCountInMatchCreation() + { + Assert.Throws(() => { new Match(1); }); + + Match match2Player = new Match(2); + + Match match3Player = new Match(3); + + Match match4Player = new Match(4); + + Assert.Throws(() => { new Match(5); }); + } +} \ No newline at end of file diff --git a/src/LittleTown.Core/LittleTown.Core.csproj b/src/LittleTown.Core/LittleTown.Core.csproj new file mode 100644 index 0000000..d7b5bc5 --- /dev/null +++ b/src/LittleTown.Core/LittleTown.Core.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + true + true + true + true + All + + + diff --git a/src/LittleTown.Core/MatchAggregate/Match.cs b/src/LittleTown.Core/MatchAggregate/Match.cs new file mode 100644 index 0000000..6a5406e --- /dev/null +++ b/src/LittleTown.Core/MatchAggregate/Match.cs @@ -0,0 +1,20 @@ +namespace LittleTown.Core; + +/// +/// Represente un match de LittleTown +/// +public class Match +{ + private const int _minPlayerCount = 2; + private const int _maxPlayerCount = 4; + + /// + /// Constructeur d'une nouvelle partie avec un nombre de joueurs données en parametres + /// + /// + public Match(int nbPlayer) + { + ArgumentOutOfRangeException.ThrowIfLessThan(nbPlayer, _minPlayerCount); + ArgumentOutOfRangeException.ThrowIfGreaterThan(nbPlayer, _maxPlayerCount); + } +} \ No newline at end of file diff --git a/src/LittleTown.Core/readme.adoc b/src/LittleTown.Core/readme.adoc new file mode 100644 index 0000000..e65f6ec --- /dev/null +++ b/src/LittleTown.Core/readme.adoc @@ -0,0 +1,4 @@ + +Projet Core + +C'est ici que doit vivre tout les elements métiers. Ici, les termes utilisés sont les même termes que ceux utilisé quand on parle du métier. \ No newline at end of file diff --git a/src/LittleTown.sln b/src/LittleTown.sln new file mode 100644 index 0000000..e97ccff --- /dev/null +++ b/src/LittleTown.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LittleTown.Core", "LittleTown.Core\LittleTown.Core.csproj", "{E1A228C7-E008-47F4-9EBC-148D4A9071E0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LittleTown.Core.Tests", "LittleTown.Core.Tests\LittleTown.Core.Tests.csproj", "{32D41FF2-0674-4750-A171-010AB228AF18}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E1A228C7-E008-47F4-9EBC-148D4A9071E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1A228C7-E008-47F4-9EBC-148D4A9071E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1A228C7-E008-47F4-9EBC-148D4A9071E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1A228C7-E008-47F4-9EBC-148D4A9071E0}.Release|Any CPU.Build.0 = Release|Any CPU + {32D41FF2-0674-4750-A171-010AB228AF18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {32D41FF2-0674-4750-A171-010AB228AF18}.Debug|Any CPU.Build.0 = Debug|Any CPU + {32D41FF2-0674-4750-A171-010AB228AF18}.Release|Any CPU.ActiveCfg = Release|Any CPU + {32D41FF2-0674-4750-A171-010AB228AF18}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal