Ajout de la classe Monstre, et tests de la classe dans la console -> FONCTIONNEL

pull/32/head
Nicolas BLONDEAU 2 years ago
parent 4045956a69
commit b050ea331c

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Modèle\Modèle.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,27 @@
// See https://aka.ms/new-console-template for more information
using Modèle;
using System;
using System.Reflection.PortableExecutable;
//Création non permanente d'une liste de caractéristiques (pour tests) -> PEUT-ÊTRE EN FAIRE UNE CLASSE PLUS TARD???
List<string> charact = new List<string>();
charact.AddRange(new List<string> { "Caractéristique 1", "C2", "C3", "ENCORE UNE CARACTÉRISTIQUE", "Again and again" });
//Création non permanente d'une liste d'apparences (pour tests) -> PEUT-ÊTRE EN FAIRE UNE CLASSE PLUS TARD AUSSI???
List<string> appear = new List<string>();
appear.AddRange(new List<string> { "Wow1", "Wow2", "Wow3", "ENCORE UNE APPARENCE" });
Monstre monstre = new Monstre ( 1, "Warden", "Le Warden est une entité conçue pour vous traquer. Il est comme un GPS vivant capable d'optimiser ses déplacements pour vous contrer," +
" sachant que s'il n'arrive pas à vous coincer, il pourra toujours utiliser son attaque... [Plus]", charact, appear);
Console.WriteLine(monstre.IntroduceTest());
Console.WriteLine();
Console.WriteLine("Liste de mes caractéristiques :");
monstre.CharacteristicsList.ForEach(Console.WriteLine);
Console.WriteLine();
Console.WriteLine("Liste de mes apparences :");
monstre.AppearanceList.ForEach(Console.WriteLine);
Console.WriteLine();
Console.WriteLine();
Monstre monstre2 = new Monstre(423, "Mouton", "Je suis un animal présent dans la campagne.", charact, appear);
Console.WriteLine(monstre2.IntroduceTest());

@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vues", "Vues\Vues.csproj", "{6474A056-564C-44CE-910D-5B78BA1D8AAA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vues", "Vues\Vues.csproj", "{6474A056-564C-44CE-910D-5B78BA1D8AAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "Console\Console.csproj", "{BCF060B8-BED1-4885-B9DD-F4BD391B6726}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Modèle", "Modèle\Modèle.csproj", "{D11EF161-2695-4FCF-8A91-C2E736AF791E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,6 +21,14 @@ Global
{6474A056-564C-44CE-910D-5B78BA1D8AAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6474A056-564C-44CE-910D-5B78BA1D8AAA}.Release|Any CPU.Build.0 = Release|Any CPU
{6474A056-564C-44CE-910D-5B78BA1D8AAA}.Release|Any CPU.Deploy.0 = Release|Any CPU
{BCF060B8-BED1-4885-B9DD-F4BD391B6726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCF060B8-BED1-4885-B9DD-F4BD391B6726}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCF060B8-BED1-4885-B9DD-F4BD391B6726}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCF060B8-BED1-4885-B9DD-F4BD391B6726}.Release|Any CPU.Build.0 = Release|Any CPU
{D11EF161-2695-4FCF-8A91-C2E736AF791E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D11EF161-2695-4FCF-8A91-C2E736AF791E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D11EF161-2695-4FCF-8A91-C2E736AF791E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D11EF161-2695-4FCF-8A91-C2E736AF791E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,48 @@
using System.ComponentModel;
using System.Reflection.Metadata;
namespace Modèle;
public class Monstre
{
public int Id { get; set; } = 1;
public string Name { get; set; }
public string Description { get; set; } = string.Empty;
private List<string> characteristic;
public List<string> CharacteristicsList
{
get {
return characteristic;
}
set {
characteristic = value;
}
}
private List<string> appearance;
public List<string> AppearanceList
{
get
{
return appearance;
}
set
{
appearance = value;
}
}
public string IntroduceTest()
{
return $"Je suis un {Name} (id : {Id}). Description : {Description}";
}
public Monstre(int id, string name, string desc, List<string> characList, List<string> appearList)
{
Id = id;
Name = name;
Description = desc;
CharacteristicsList = characList;
AppearanceList = appearList;
}
}
Loading…
Cancel
Save