Creation de la solution et de la classe Match

This commit was merged in pull request #2.
This commit is contained in:
2024-05-20 22:50:42 +02:00
parent 0b1fd87037
commit 9567423195
10 changed files with 138 additions and 1 deletions

20
.editorconfig Normal file
View File

@@ -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

3
.gitignore vendored
View File

@@ -12,3 +12,6 @@
# Built Visual Studio Code Extensions
*.vsix
bin
obj

View File

@@ -1,3 +1,3 @@
# LittleTown
= LittleTown
Petit projet d'adaptation de littleTown en ligne

View File

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

View File

@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.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="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LittleTown.Core\LittleTown.Core.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,18 @@
namespace LittleTown.Core.Tests;
public class MatchTesting
{
[Fact]
public void EnforcePlayerCountInMatchCreation()
{
Assert.Throws<ArgumentOutOfRangeException>(() => { new Match(1); });
Match match2Player = new Match(2);
Match match3Player = new Match(3);
Match match4Player = new Match(4);
Assert.Throws<ArgumentOutOfRangeException>(() => { new Match(5); });
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<InvariantGlobalization>true</InvariantGlobalization>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisMode>All</AnalysisMode>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,20 @@
namespace LittleTown.Core;
/// <summary>
/// Represente un match de LittleTown
/// </summary>
public class Match
{
private const int _minPlayerCount = 2;
private const int _maxPlayerCount = 4;
/// <summary>
/// Constructeur d'une nouvelle partie avec un nombre de joueurs données en parametres
/// </summary>
/// <param name="nbPlayer"></param>
public Match(int nbPlayer)
{
ArgumentOutOfRangeException.ThrowIfLessThan(nbPlayer, _minPlayerCount);
ArgumentOutOfRangeException.ThrowIfGreaterThan(nbPlayer, _maxPlayerCount);
}
}

View File

@@ -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.

28
src/LittleTown.sln Normal file
View File

@@ -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