Corrections bugs et tests unitaires
continuous-integration/drone/push Build is passing Details

pull/15/head
Yoan 2 years ago
parent caef9adde9
commit 12afbc962d

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -12,13 +14,14 @@ namespace Model.Classes
public class Bateau : ObjetOhara public class Bateau : ObjetOhara
{ {
[DataMember(Name = "nomromanise")] [DataMember(Name = "nomromanise")]
private string nomromanise; private string? nomromanise;
public string NomRomanise { public string? NomRomanise {
get=>nomromanise; get=>nomromanise;
set set
{ {
if(nomromanise == value) return; if(nomromanise == value) return;
nomromanise = value; nomromanise = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "affiliation", EmitDefaultValue = false)] [DataMember(Name = "affiliation", EmitDefaultValue = false)]
@ -29,6 +32,7 @@ namespace Model.Classes
{ {
if(equipage == value) return; if(equipage == value) return;
equipage = value; equipage = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "premierchap")] [DataMember(Name = "premierchap")]
@ -40,6 +44,7 @@ namespace Model.Classes
{ {
if (premierchap == value) return; if (premierchap == value) return;
premierchap = value; premierchap = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "premierep")] [DataMember(Name = "premierep")]
@ -51,37 +56,42 @@ namespace Model.Classes
{ {
if (premierep == value) return; if (premierep == value) return;
premierep = value; premierep = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "description")] [DataMember(Name = "description")]
private string description; private string? description;
public string Description public string? Description
{ {
get => description; get => description;
set set
{ {
if (description == value) return; if (description == value) return;
description = value; description = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "caracteristique")] [DataMember(Name = "caracteristique")]
private string caracteristique; private string? caracteristique;
public string Caracteristique { public string? Caracteristique {
get=> caracteristique; get=> caracteristique;
set set
{ {
if(caracteristique == value) return; if(caracteristique == value) return;
caracteristique = value; caracteristique = value;
OnPropertyChanged();
} }
} }
public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string caracteristique) : base(nom) public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string? caracteristique) : base(nom)
{ {
if (String.IsNullOrEmpty(nomRomanise))
NomRomanise = "";
else
NomRomanise = nomRomanise; NomRomanise = nomRomanise;
if (premierEp < 0) if (premierEp < 0)
{ {
PremierEp = 0; PremierEp = 0;
@ -90,28 +100,33 @@ namespace Model.Classes
{ {
PremierEp = premierEp; PremierEp = premierEp;
} }
if (premierChap < 0) if (premierChap < 0 )
{ {
premierChap = 0; PremierChap = 0;
} }
else else
{ {
PremierChap = premierChap; PremierChap = premierChap;
} }
if (String.IsNullOrEmpty(description))
Description = "Description du bateau ...";
else
Description = description; Description = description;
if (String.IsNullOrEmpty(caracteristique))
Caracteristique = "Caracteristiques du bateau ...";
else
Caracteristique = caracteristique; Caracteristique = caracteristique;
} }
public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string caracteristique, string image) : this(nom, nomRomanise, premierChap, premierEp, description, caracteristique) public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string caracteristique, string image) : this(nom, nomRomanise, premierChap, premierEp, description, caracteristique)
{ {
if (String.IsNullOrEmpty(image))
image = "baseimage.png";
Image = image; Image = image;
} }
public Bateau(string nom, string nomRomanise, Equipage affiliation, int premierChap, int premierEp, string description, string caracteristique, string image) : this(nom, nomRomanise, premierChap, premierEp, description, caracteristique, image)
{
Affiliation = affiliation;
}
public override bool Equals(object? obj) public override bool Equals(object? obj)
{ {
@ -138,5 +153,7 @@ namespace Model.Classes
{ {
return "Bateau :" + Nom +" "+EstFavori +" " + NomRomanise + " " + Affiliation + " " + PremierChap + " " + PremierEp + " " + Description + " " + Caracteristique +" "+ Image; return "Bateau :" + Nom +" "+EstFavori +" " + NomRomanise + " " + Affiliation + " " + PremierChap + " " + PremierEp + " " + Description + " " + Caracteristique +" "+ Image;
} }
} }
} }

@ -12,13 +12,11 @@ using System.Xml.Linq;
namespace Model.Classes namespace Model.Classes
{ {
[DataContract(Name = "bestiaire")] [DataContract(Name = "bestiaire")]
public class Bestiaire : ObjetOhara, INotifyPropertyChanged public class Bestiaire : ObjetOhara
{ {
public event PropertyChangedEventHandler? PropertyChanged;
[DataMember(Name = "origine")] [DataMember(Name = "origine")]
private string origine; private string? origine;
public string Origine { public string? Origine {
get=>origine; get=>origine;
set set
{ {
@ -28,8 +26,8 @@ namespace Model.Classes
} }
} }
[DataMember(Name = "description")] [DataMember(Name = "description")]
private string description; private string? description;
public string Description { public string? Description {
get=>description; get=>description;
set set
{ {
@ -39,8 +37,8 @@ namespace Model.Classes
} }
} }
[DataMember(Name = "caracteristique")] [DataMember(Name = "caracteristique")]
private string caracteristique; private string? caracteristique;
public string Caracteristique { public string? Caracteristique {
get=>caracteristique; get=>caracteristique;
set set
{ {
@ -52,13 +50,21 @@ namespace Model.Classes
public Bestiaire(string nom, string origine, string description, string caracteristique) : base(nom) public Bestiaire(string nom, string origine, string description, string caracteristique) : base(nom)
{ {
if (String.IsNullOrEmpty(origine))
origine = "Grand Line";
Origine = origine; Origine = origine;
if (String.IsNullOrEmpty(description))
description = "Pour décrire ...";
Description = description; Description = description;
if (String.IsNullOrEmpty(caracteristique))
caracteristique = "Les caracteristiques ...";
Caracteristique = caracteristique; Caracteristique = caracteristique;
} }
public Bestiaire(string nom, string origine, string description, string caracteristique, string image) : this(nom, origine, description, caracteristique) public Bestiaire(string nom, string origine, string description, string caracteristique, string image) : this(nom, origine, description, caracteristique)
{ {
if (String.IsNullOrWhiteSpace(image))
image = "baseimage.png";
Image = image; Image = image;
} }
public override bool Equals(object? obj) public override bool Equals(object? obj)
@ -75,18 +81,13 @@ namespace Model.Classes
} }
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return HashCode.Combine(Origine, Description, Caracteristique); return HashCode.Combine(Origine, Description, Caracteristique);
} }
public override string ToString() public override string ToString()
{ {
return "Bestiaire :" + Nom +" "+EstFavori+ " " + Origine + " " + Description + " " + Caracteristique +" " + Image; return "Bestiaire :" + Nom +" "+EstFavori+ " " + Origine + " " + Description + " " + Caracteristique +" " + Image;
} }
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -12,17 +14,72 @@ namespace Model.Classes
public class Equipage : ObjetOhara public class Equipage : ObjetOhara
{ {
[DataMember(Name = "nomromanise")] [DataMember(Name = "nomromanise")]
public string NomRomanise { get; set; } private string? nomromanise;
public string? NomRomanise
{
get => nomromanise;
set
{
if (nomromanise == value) return;
nomromanise = value;
OnPropertyChanged();
}
}
[DataMember(Name = "region")] [DataMember(Name = "region")]
public string Region { get; set; } private string? region;
public string? Region {
get=> region;
set
{
if (region == value) return;
region = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierchap")] [DataMember(Name = "premierchap")]
public int PremierChap { get; set; } private int premierchap;
public int PremierChap {
get=>premierchap;
set
{
if(premierchap == value) return;
premierchap = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierep")] [DataMember(Name = "premierep")]
public int PremierEp { get; set; } private int premierep;
public int PremierEp {
get=>premierep;
set
{
if(premierep == value) return;
premierep = value;
OnPropertyChanged();
}
}
[DataMember(Name = "statut")] [DataMember(Name = "statut")]
public bool Statut { get; set; } private bool statut;
public bool Statut {
get=>statut;
set
{
if (statut == value) return;
statut = value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")] [DataMember(Name = "description")]
public string Description { get; set; } private string? description;
public string? Description {
get=>description;
set
{
if(description == value) return;
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "capitaine")] [DataMember(Name = "capitaine")]
public Personnage? Capitaine { get; set; } public Personnage? Capitaine { get; set; }
[DataMember(Name = "membre")] [DataMember(Name = "membre")]
@ -59,7 +116,10 @@ namespace Model.Classes
public Equipage(string nom, string nomRomanise, string region, int premierChap, int premierEp, bool statut, string description, string image) : this(nom, nomRomanise, region, premierChap, premierEp, statut, description) public Equipage(string nom, string nomRomanise, string region, int premierChap, int premierEp, bool statut, string description, string image) : this(nom, nomRomanise, region, premierChap, premierEp, statut, description)
{ {
if (String.IsNullOrWhiteSpace(image))
{
image = "baseimage.png";
}
Image = image; Image = image;
} }

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -10,26 +11,88 @@ using System.Xml.Linq;
namespace Model.Classes namespace Model.Classes
{ {
[DataContract(Name = "fruitdudemon")] [DataContract(Name = "fruitdudemon")]
public class FruitDuDemon : ObjetOhara,INotifyPropertyChanged public class FruitDuDemon : ObjetOhara
{ {
[DataMember(Name = "nomromanise")] [DataMember(Name = "nomromanise")]
public string NomRomanise { get; set; } private string? nomromanise;
public string? NomRomanise {
get=>nomromanise;
set
{
if(nomromanise==value) return;
nomromanise = value;
OnPropertyChanged();
}
}
[DataMember(Name = "type")] [DataMember(Name = "type")]
public string Type { get; set; } private string? type;
public string? Type {
get=>type;
set
{
if(type==value) return;
type = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierchap")] [DataMember(Name = "premierchap")]
public int PremierChap { get; set; } private int premierchap;
public int PremierChap {
get=>premierchap;
set
{
if(premierchap==value) return;
premierchap = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierep")] [DataMember(Name = "premierep")]
public int PremierEp { get; set; } private int premierep;
public int PremierEp {
get=>premierep;
set
{
if (premierep==value) return;
premierep=value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")] [DataMember(Name = "description")]
public string Description { get; set; } private string? description;
public string? Description {
get=>description;
set
{
if (description==value) return;
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "forces")] [DataMember(Name = "forces")]
public string Forces { get; set; } private string? forces;
public string? Forces {
get=>forces;
set
{
if (forces==value) return;
forces = value;
OnPropertyChanged();
}
}
[DataMember(Name = "faiblesses")] [DataMember(Name = "faiblesses")]
public string Faiblesses { get; set; } private string? faiblesses;
public string? Faiblesses {
get=>faiblesses;
set
{
if (faiblesses == value) return;
faiblesses = value;
OnPropertyChanged();
}
}
[DataMember(Name = "utilisateur", EmitDefaultValue = false)] [DataMember(Name = "utilisateur", EmitDefaultValue = false)]
public List<Personnage> Utilisateur { get; set; } = new List<Personnage>(); public List<Personnage> Utilisateur { get; set; } = new List<Personnage>();
public event PropertyChangedEventHandler? PropertyChanged;
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses) : base(nom) public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses) : base(nom)
{ {
@ -46,7 +109,7 @@ namespace Model.Classes
} }
if (premierChap < 0) if (premierChap < 0)
{ {
premierChap = 0; PremierChap = 0;
} }
else else
{ {
@ -59,17 +122,10 @@ namespace Model.Classes
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses) public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses)
{ {
if (String.IsNullOrWhiteSpace(image))
image = "baseimage.png";
Image = image; Image = image;
} }
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image, List<Personnage> utilisateur) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses, image)
{
Utilisateur = utilisateur;
}
public override bool Equals(object? obj) public override bool Equals(object? obj)
{ {
if (obj == null) return false; if (obj == null) return false;
@ -94,13 +150,5 @@ namespace Model.Classes
{ {
return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image; return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image;
} }
void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
} }
} }

@ -11,14 +11,11 @@ using System.Xml.Linq;
namespace Model.Classes namespace Model.Classes
{ {
[DataContract(Name = "ile")] [DataContract(Name = "ile")]
public class Ile : ObjetOhara, INotifyPropertyChanged public class Ile : ObjetOhara
{ {
public event PropertyChangedEventHandler? PropertyChanged;
[DataMember(Name = "nomromanise")] [DataMember(Name = "nomromanise")]
private string nomromanise; private string? nomromanise;
public string NomRomanise public string? NomRomanise
{ {
get => nomromanise; get => nomromanise;
set set
@ -30,8 +27,8 @@ namespace Model.Classes
} }
[DataMember(Name = "region")] [DataMember(Name = "region")]
private string region; private string? region;
public string Region { public string? Region {
get=>region; get=>region;
set set
{ {
@ -63,8 +60,8 @@ namespace Model.Classes
} }
} }
[DataMember(Name = "description")] [DataMember(Name = "description")]
private string description; private string? description;
public string Description { public string? Description {
get=>description; get=>description;
set set
{ {
@ -74,8 +71,8 @@ namespace Model.Classes
} }
} }
[DataMember(Name = "geographie")] [DataMember(Name = "geographie")]
private string geographie; private string? geographie;
public string Geographie { public string? Geographie {
get=>geographie; get=>geographie;
set set
{ {
@ -89,8 +86,11 @@ namespace Model.Classes
public Ile(string nom, string nomRomanise, string region, int premierChap, int premierEp, string description, string geographie) : base(nom) public Ile(string nom, string nomRomanise, string region, int premierChap, int premierEp, string description, string geographie) : base(nom)
{ {
if (String.IsNullOrWhiteSpace(nomRomanise))
nomRomanise = "Nom romanisé de l'île...";
NomRomanise = nomRomanise; NomRomanise = nomRomanise;
if (String.IsNullOrWhiteSpace(region))
region = "Grand Line";
Region = region; Region = region;
if (premierEp < 0) if (premierEp < 0)
{ {
@ -102,20 +102,26 @@ namespace Model.Classes
} }
if (premierChap < 0) if (premierChap < 0)
{ {
premierChap = 0; PremierChap = 0;
} }
else else
{ {
PremierChap = premierChap; PremierChap = premierChap;
} }
if (String.IsNullOrWhiteSpace(description))
description = "Description de l'île ...";
Description = description; Description = description;
if (String.IsNullOrWhiteSpace(geographie))
geographie = "Situation géographique de l'ile...";
Geographie = geographie; Geographie = geographie;
} }
public Ile(string nom, string nomRomanise, string region, int premierChap, int premierEp, string description, string geographie, string image) : this(nom, nomRomanise, region, premierChap, premierEp, description, geographie) public Ile(string nom, string nomRomanise, string region, int premierChap, int premierEp, string description, string geographie, string image) : this(nom, nomRomanise, region, premierChap, premierEp, description, geographie)
{ {
if(String.IsNullOrWhiteSpace(image)) {
image = "baseimage.png";
}
Image = image; Image = image;
} }
@ -144,8 +150,5 @@ namespace Model.Classes
{ {
return "Ile :"+ Nom +" "+NomRomanise+" "+Region+" "+PremierChap+" "+PremierEp+" "+Description+" "+Geographie+" "+Image; return "Ile :"+ Nom +" "+NomRomanise+" "+Region+" "+PremierChap+" "+PremierEp+" "+Description+" "+Geographie+" "+Image;
} }
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }

@ -16,8 +16,8 @@ namespace Model.Classes
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;
[DataMember(Name = "nom")] [DataMember(Name = "nom")]
private string nom; private string? nom;
public string Nom { public string? Nom {
get => nom; get => nom;
set set
{ {
@ -95,7 +95,7 @@ namespace Model.Classes
return "ObjetOhara :" + Nom + " " +EstFavori+ " " + Image; return "ObjetOhara :" + Nom + " " +EstFavori+ " " + Image;
} }
void OnPropertyChanged([CallerMemberName] string propertyName = null) protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
} }

@ -1,4 +1,6 @@
using System.Runtime.Serialization; using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace Model.Classes namespace Model.Classes
{ {
@ -17,11 +19,12 @@ namespace Model.Classes
return; return;
} }
prime = value; prime = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "epithete")] [DataMember(Name = "epithete")]
private string epithete; private string? epithete;
public string Epithete { public string? Epithete {
get=>epithete; get=>epithete;
set set
{ {
@ -43,6 +46,7 @@ namespace Model.Classes
return; return;
} }
age = value; age = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "taille")] [DataMember(Name = "taille")]
@ -56,11 +60,12 @@ namespace Model.Classes
return; return;
} }
taille = value; taille = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "origine")] [DataMember(Name = "origine")]
private string origine; private string? origine;
public string Origine { public string? Origine {
get=>origine; get=>origine;
set set
{ {
@ -69,11 +74,12 @@ namespace Model.Classes
return; return;
} }
origine = value; origine = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "biographie")] [DataMember(Name = "biographie")]
private string biographie; private string? biographie;
public string Biographie { public string? Biographie {
get=>biographie; get=>biographie;
set set
{ {
@ -82,11 +88,12 @@ namespace Model.Classes
return; return;
} }
biographie = value; biographie = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "citation")] [DataMember(Name = "citation")]
private string citation; private string? citation;
public string Citation { public string? Citation {
get=>citation; get=>citation;
set set
{ {
@ -95,11 +102,12 @@ namespace Model.Classes
return; return;
} }
citation = value; citation = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "equipage", EmitDefaultValue = false)] [DataMember(Name = "equipage", EmitDefaultValue = false)]
private Equipage equipage; private Equipage? equipage;
public Equipage Equipage { public Equipage? Equipage {
get => equipage; get => equipage;
set set
{ {
@ -108,6 +116,7 @@ namespace Model.Classes
return; return;
} }
equipage = value; equipage = value;
OnPropertyChanged();
} }
} }
[DataMember(Name = "fruit", EmitDefaultValue = false)] [DataMember(Name = "fruit", EmitDefaultValue = false)]
@ -146,15 +155,10 @@ namespace Model.Classes
public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation, string image) : this(nom, prime, epithete, age, taille, origine, biographie, citation) public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation, string image) : this(nom, prime, epithete, age, taille, origine, biographie, citation)
{ {
if (String.IsNullOrWhiteSpace(image))
image = "baseimage.png";
Image = image; Image = image;
} }
public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation, string image, Equipage equipage, List<FruitDuDemon> fruit) : this(nom, prime, epithete, age, taille, origine, biographie, citation, image)
{
Equipage = equipage;
Fruit = fruit;
}
public override bool Equals(object? obj) public override bool Equals(object? obj)
{ {
if (obj == null) return false; if (obj == null) return false;
@ -172,7 +176,6 @@ namespace Model.Classes
public override int GetHashCode() public override int GetHashCode()
{ {
return HashCode.Combine(Prime, Epithete, Age, Origine,Biographie, Citation,Equipage,Fruit); return HashCode.Combine(Prime, Epithete, Age, Origine,Biographie, Citation,Equipage,Fruit);
} }

@ -99,7 +99,7 @@ namespace Model.Managers
{ {
bool correspondance = false; bool correspondance = false;
int textPos = 0; int textPos = 0;
for (int i = 0; i < (f.Nom.Length); i++) for (int i = 0; i < (f.Nom?.Length); i++)
{ {
if (string.Equals(text[textPos].ToString(), f.Nom[i].ToString(), StringComparison.OrdinalIgnoreCase)) if (string.Equals(text[textPos].ToString(), f.Nom[i].ToString(), StringComparison.OrdinalIgnoreCase))
{ {
@ -290,5 +290,12 @@ namespace Model.Managers
Fruits.Remove(ancienFDD); Fruits.Remove(ancienFDD);
Fruits.Add(fruit); Fruits.Add(fruit);
} }
public void ModifierPerso(Personnage perso, string ancienNom)
{
Personnage? ancienPerso = Personnages.FirstOrDefault(p => p.Nom == ancienNom);
if (ancienPerso == null) return;
Personnages.Remove(ancienPerso);
Personnages.Add(perso);
}
} }
} }

@ -18,27 +18,27 @@ namespace Model.Serializer
{ {
StubManager stubManager = new StubManager(); StubManager stubManager = new StubManager();
Chemin = Directory.GetCurrentDirectory(); Chemin = Directory.GetCurrentDirectory();
if (File.Exists(Path.Combine(Chemin, "./personnage.xml"))==false) if (!File.Exists(Path.Combine(Chemin, "./personnage.xml")))
{ {
SetPersonnage(stubManager.GetPersonnages().ToList()); SetPersonnage(stubManager.GetPersonnages().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./bateau.xml")))
{ {
SetBateau(stubManager.GetBateaux().ToList()); SetBateau(stubManager.GetBateaux().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")))
{ {
SetFDD(stubManager.GetFruits().ToList()); SetFDD(stubManager.GetFruits().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./bestiaire.xml")))
{ {
SetBestiaire(stubManager.GetBestiaires().ToList()); SetBestiaire(stubManager.GetBestiaires().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./equipage.xml")))
{ {
SetEquipage(stubManager.GetEquipages().ToList()); SetEquipage(stubManager.GetEquipages().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./ile.xml")))
{ {
SetIle(stubManager.GetIles().ToList()); SetIle(stubManager.GetIles().ToList());
} }
@ -48,27 +48,27 @@ namespace Model.Serializer
{ {
Chemin= path; Chemin= path;
StubManager stubManager = new StubManager(); StubManager stubManager = new StubManager();
if (File.Exists(Path.Combine(Chemin, "./personnage.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./personnage.xml")))
{ {
SetPersonnage(stubManager.GetPersonnages().ToList()); SetPersonnage(stubManager.GetPersonnages().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./bateau.xml")))
{ {
SetBateau(stubManager.GetBateaux().ToList()); SetBateau(stubManager.GetBateaux().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")))
{ {
SetFDD(stubManager.GetFruits().ToList()); SetFDD(stubManager.GetFruits().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./bestiaire.xml")))
{ {
SetBestiaire(stubManager.GetBestiaires().ToList()); SetBestiaire(stubManager.GetBestiaires().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./equipage.xml")))
{ {
SetEquipage(stubManager.GetEquipages().ToList()); SetEquipage(stubManager.GetEquipages().ToList());
} }
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false) if (!File.Exists(Path.Combine(Chemin, "./ile.xml")))
{ {
SetIle(stubManager.GetIles().ToList()); SetIle(stubManager.GetIles().ToList());
} }

@ -9,7 +9,7 @@ namespace Model.Stub
{ {
public class StubEquipage public class StubEquipage
{ {
public List<Equipage> Equipages { get; set; } public List<Equipage>? Equipages { get; set; }
public void ChargerEquipage(List<Personnage> persos) public void ChargerEquipage(List<Personnage> persos)
{ {

@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.ModalPersonnage" x:Class="Ohara.ModalPersonnage"
Title="ModalPersonnage" Title="ModalPersonnage"
BackgroundColor="#e2edf1"> BackgroundColor="#e2edf1"
Shell.PresentationMode="ModalAnimated">
<ScrollView> <ScrollView>
<FlexLayout AlignItems="End" Wrap="Wrap" Direction="Row" JustifyContent="Center" HorizontalOptions="Center" VerticalOptions="Center" > <FlexLayout AlignItems="End" Wrap="Wrap" Direction="Row" JustifyContent="Center" HorizontalOptions="Center" VerticalOptions="Center" >
<VerticalStackLayout Spacing="4" Margin="2"> <VerticalStackLayout Spacing="4" Margin="2">
@ -21,12 +22,7 @@
</Frame> </Frame>
<Button Text="Choisir une image ..." Clicked="ButtonImage_Clicked" Grid.Row="2" VerticalOptions="End" /> <Button Text="Choisir une image ..." Clicked="ButtonImage_Clicked" Grid.Row="2" VerticalOptions="End" />
</Grid> </Grid>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Nom Romanise :" FontAttributes="Bold"/>
<Entry Text="{Binding NomRomanise}" />
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameModif}"> <Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center"> <HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Prime :" FontAttributes="Bold"/> <Label Text="Prime :" FontAttributes="Bold"/>
@ -39,6 +35,12 @@
<Entry Text="{Binding Epithete}" /> <Entry Text="{Binding Epithete}" />
</HorizontalStackLayout> </HorizontalStackLayout>
</Frame> </Frame>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Taille :" FontAttributes="Bold"/>
<Entry Text="{Binding Taille}" />
</HorizontalStackLayout>
</Frame>
<Button Text="Annuler" Style="{StaticResource buttonRetirerFavInfo}" Clicked="ButtonAnnuler_Clicked" /> <Button Text="Annuler" Style="{StaticResource buttonRetirerFavInfo}" Clicked="ButtonAnnuler_Clicked" />
</VerticalStackLayout > </VerticalStackLayout >
@ -51,14 +53,14 @@
</Frame> </Frame>
<Frame Style="{StaticResource frameModif}"> <Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center"> <HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Description :" FontAttributes="Bold"/> <Label Text="Biographie :" FontAttributes="Bold"/>
<Editor Text="{Binding Description}" WidthRequest="300" HeightRequest="200"/> <Editor Text="{Binding Biographie}" WidthRequest="300" HeightRequest="200"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</Frame> </Frame>
<Frame Style="{StaticResource frameModif}"> <Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center"> <HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Geographie :" FontAttributes="Bold"/> <Label Text="Citation :" FontAttributes="Bold"/>
<Editor Text="{Binding Geographie}" WidthRequest="300" HeightRequest="150"/> <Editor Text="{Binding Citation}" WidthRequest="300" HeightRequest="150"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</Frame> </Frame>
<Button Text="Confirmer" Style="{StaticResource buttonFavsInfo}" Clicked="ButtonConfirmer_Clicked" /> <Button Text="Confirmer" Style="{StaticResource buttonFavsInfo}" Clicked="ButtonConfirmer_Clicked" />

@ -6,15 +6,35 @@ namespace Ohara;
public partial class ModalPersonnage : ContentPage public partial class ModalPersonnage : ContentPage
{ {
public Manager manager => (App.Current as App).manager; public Manager manager => (App.Current as App).manager;
public Personnage nouveauPerso = new Personnage("Personnage", 0, "", 0, 0, "", "", ""); public Personnage nouveauPerso;
public string ancienNom;
public ModalPersonnage() public ModalPersonnage()
{ {
if (manager.SelectedItem != null)
{
nouveauPerso = manager.SelectedItem as Personnage;
ancienNom = nouveauPerso.Nom;
}
else
{
nouveauPerso = new Personnage("Personnage",0, " ", 0, 0, " ", " ", "");
}
InitializeComponent(); InitializeComponent();
BindingContext = nouveauPerso; BindingContext = nouveauPerso;
} }
private async void ButtonConfirmer_Clicked(object sender, EventArgs e) private async void ButtonConfirmer_Clicked(object sender, EventArgs e)
{
if (manager.SelectedItem != null)
{
manager.ModifierPerso(nouveauPerso, ancienNom);
nouveauPerso = manager.SelectedItem as Personnage;
}
else
{ {
manager.AjouterPerso(nouveauPerso); manager.AjouterPerso(nouveauPerso);
}
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
private async void ButtonAnnuler_Clicked(object sender, EventArgs e) private async void ButtonAnnuler_Clicked(object sender, EventArgs e)

@ -31,6 +31,7 @@ public partial class PageBateau : ContentPage
private async void Button_Clicked(object sender, EventArgs e) private async void Button_Clicked(object sender, EventArgs e)
{ {
manager.SelectedItem = null;
await Shell.Current.GoToAsync(nameof(ModalBateau)); await Shell.Current.GoToAsync(nameof(ModalBateau));
} }
private void PickerFiltre_SelectedIndexChanged(object sender, EventArgs e) private void PickerFiltre_SelectedIndexChanged(object sender, EventArgs e)

@ -38,6 +38,7 @@ public partial class PageBestiaire : ContentPage
private async void ButtonAjouter_Clicked(object sender, EventArgs e) private async void ButtonAjouter_Clicked(object sender, EventArgs e)
{ {
manager.SelectedItem = null;
await Navigation.PushModalAsync(new ModalBestiaire()); await Navigation.PushModalAsync(new ModalBestiaire());
} }
} }

@ -41,14 +41,14 @@ Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux) foreach (Bateau b in manager.Bateaux)
{ {
manager.ModifierFavoris(b, false); manager.ModifierFavBateau(b, false);
} }
//Tests serialization : //Tests serialization :
XML_Serializer serializer = new XML_Serializer(); XML_Serializer serializer = new XML_Serializer();
//Affichage d'un objet à son état initiale //Affichage d'un objet à son état initiale
Console.WriteLine(manager.Bateaux[0]); Console.WriteLine(manager.Bateaux[0]);
//Modification de cet objet //Modification de cet objet
manager.ModifierFavoris(manager.Bateaux[0], true); manager.ModifierFavBateau(manager.Bateaux[0], true);
Console.WriteLine(manager.Bateaux[0]); Console.WriteLine(manager.Bateaux[0]);
//Serialization de la liste contenant l'objet //Serialization de la liste contenant l'objet
serializer.SetBateau(manager.Bateaux.ToList()); serializer.SetBateau(manager.Bateaux.ToList());
@ -65,17 +65,17 @@ Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux) foreach (Bateau b in manager.Bateaux)
{ {
manager.ModifierFavoris(b, false); manager.ModifierFavBateau(b, false);
} }
//Ajout d'un objet en favoris //Ajout d'un objet en favoris
manager.ModifierFavoris(manager.Bateaux[0],true); manager.ModifierFavBateau(manager.Bateaux[0],true);
foreach (ObjetOhara o in manager.GetFavoris()) foreach (ObjetOhara o in manager.GetFavoris())
{ {
Console.WriteLine(o.Nom); Console.WriteLine(o.Nom);
} }
//Suppréssion d'un objet des favoris //Suppréssion d'un objet des favoris
manager.ModifierFavoris(manager.Bateaux[0], false); manager.ModifierFavBateau(manager.Bateaux[0], false);
foreach (ObjetOhara o in manager.GetFavoris()) foreach (ObjetOhara o in manager.GetFavoris())
{ {
Console.WriteLine(o.Nom); Console.WriteLine(o.Nom);
@ -92,7 +92,7 @@ foreach (FruitDuDemon f in manager.FiltrerFDD("Logia"))
Console.WriteLine("\n"); Console.WriteLine("\n");
Console.WriteLine("\n"); Console.WriteLine("\n");
// Recherche dansune liste de fruit de démon pour afficher les fruits correspondant au mot clé "Nika" // Recherche dansune liste de fruit de démon pour afficher les fruits correspondant au mot clé "Nika"
foreach (FruitDuDemon f in manager.RechercheFDD("Nika",manager.Fruits.ToList())) foreach (FruitDuDemon f in manager.RechercheObjetOhara("Nika", new List<ObjetOhara>(manager.Fruits)))
{ {
Console.WriteLine(f.Nom); Console.WriteLine(f.Nom);
} }
@ -101,7 +101,7 @@ Console.WriteLine("\n");
Console.WriteLine("\n"); Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux) foreach (Bateau b in manager.Bateaux)
{ {
manager.ModifierFavoris(b,true); manager.ModifierFavBateau(b,true);
} }

@ -0,0 +1,39 @@
using Model.Classes;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class StubBateauTests
{
[Fact]
public void RecupererBateau_ReturnsBateauxList()
{
StubBateau stubBateau = new StubBateau();
IEnumerable<Bateau> result = stubBateau.RecupererBateau();
Assert.True(result!=null,"RecupererBateau n'est pas cencé renvoyé de valeur null.");
Assert.True(result.Any(), "RecupererBateau n'est pas cencé renvoyé une liste vide.");
}
[Fact]
public void RecupererBateau_ReturnsBateauxWithCorrectProperties()
{
StubBateau stubBateau = new StubBateau();
IEnumerable<Bateau> result = stubBateau.RecupererBateau();
foreach (Bateau bateau in result)
{
Assert.False(string.IsNullOrEmpty(bateau.Nom), "Les objets de types bateaux renvoyés par la méthode RecupererBateau doivent etre correctement définit.");
Assert.False(string.IsNullOrEmpty(bateau.Description), "Les objets de types bateaux renvoyés par la méthode RecupererBateau doivent etre correctement définit.");
Assert.False(string.IsNullOrEmpty(bateau.Image), "Les objets de types bateaux renvoyés par la méthode RecupererBateau doivent etre correctement définit.");
Assert.NotNull(bateau.Affiliation);
Assert.True(bateau.PremierChap > 0);
Assert.True(bateau.PremierEp > 0);
}
}
}
}

@ -0,0 +1,48 @@
using Model.Classes;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class StubBestiaireTests
{
[Fact]
public void RecupererBestiaire_ReturnsBestiaireList()
{
// Arrange
StubBestiaire stubBestiaire = new StubBestiaire();
// Act
IEnumerable<Bestiaire> result = stubBestiaire.RecupererBestiaire();
// Assert
Assert.True(result != null, "RecupererBestiaire n'est pas cencé renvoyé de valeur null.");
Assert.True(result.Any(), "RecupererBestiaire n'est pas cencé renvoyé une liste vide.");
}
[Fact]
public void RecupererBestiaire_BestiaireHaveValidProperties()
{
// Arrange
StubBestiaire stubBestiaire = new StubBestiaire();
// Act
IEnumerable<Bestiaire> result = stubBestiaire.RecupererBestiaire();
// Assert
foreach (Bestiaire bestiaire in result)
{
Assert.NotNull(bestiaire.Nom);
Assert.NotNull(bestiaire.Origine);
Assert.NotNull(bestiaire.Description);
Assert.NotNull(bestiaire.Caracteristique);
Assert.NotNull(bestiaire.Image);
}
}
}
}

@ -0,0 +1,98 @@
using Model.Classes;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class StubEquipageTests
{
[Fact]
public void ChargerEquipage_CreatesEquipagesList()
{
// Arrange
StubEquipage stubEquipage = new StubEquipage();
List<Personnage> persos = new List<Personnage>();
// Act
stubEquipage.ChargerEquipage(persos);
List<Equipage> equipages = stubEquipage.Equipages;
// Assert
Assert.NotNull(equipages);
Assert.True(equipages != null);
}
[Fact]
public void ChargerEquipage_FillsEquipageMembers()
{
// Arrange
StubEquipage stubEquipage = new StubEquipage();
List<Personnage> persos = new List<Personnage>
{
new Personnage("Luffy",0,"",0,0,"","",""),
new Personnage("Zoro", 0, "", 0, 0, "", "", ""),
new Personnage("Nami", 0, "", 0, 0, "", "", "")
};
// Act
stubEquipage.ChargerEquipage(persos);
List<Equipage> equipages = stubEquipage.Equipages;
// Assert
Assert.NotNull(equipages);
Assert.True(equipages != null);
Equipage? paille = equipages.FirstOrDefault(e => e.Nom == "Équipage au chapeau de paille");
Assert.NotNull(paille);
Assert.True(paille.Membre != null);
Assert.True(1 == paille.Membre.Count);
Assert.True("Luffy" == paille.Membre[0].Nom);
}
[Fact]
public void RecupererEquipage_ReturnsEquipagesList()
{
StubEquipage stubEquipage = new StubEquipage();
List<Personnage> persos = new List<Personnage>
{
new Personnage("Luffy", 0, "", 0, 0, "", "", ""),
new Personnage("Zoro", 0, "", 0, 0, "", "", ""),
new Personnage("Nami", 0, "", 0, 0, "", "", "")
};
stubEquipage.ChargerEquipage( persos); ;
List<Equipage> result = stubEquipage.RecupererEquipage().ToList();
Assert.NotNull(result);
}
[Fact]
public void RemplirEquipage_AddsMembersToEquipage()
{
// Arrange
StubEquipage stubEquipage = new StubEquipage();
Equipage equipage = new Equipage("TestEquipage", "Test", "Test", 1, 1, true, "Test", "test.png");
List<Personnage> persos = new List<Personnage>
{
new Personnage("Luffy", 0, "", 0, 0, "", "", ""),
new Personnage("Zoro", 0, "", 0, 0, "", "", ""),
new Personnage("Nami", 0, "", 0, 0, "", "", "")
};
List<string> noms = new List<string> { "Luffy", "Zoro" };
// Act
Equipage result = stubEquipage.RemplirEquipage(equipage, persos, noms);
// Assert
Assert.NotNull(result);
Assert.True(result.Membre != null);
Assert.True(2 == result.Membre.Count);
Assert.True("Luffy" == result.Membre[0].Nom);
Assert.True("Zoro"== result.Membre[1].Nom);
}
}
}

@ -0,0 +1,20 @@
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class StubFruitDuDemonTests
{
[Fact]
public void RecupererFruit_ReturnsListOfFruits()
{
var stubFruitDuDemon = new StubFruitDuDemon();
var fruits = stubFruitDuDemon.RecupererFruit();
Assert.NotNull(fruits);
}
}
}

@ -0,0 +1,42 @@
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class StubIleTests
{
[Fact]
public void RecupererIle_ReturnsIleList()
{
// Arrange
var stubIle = new StubIle();
// Act
var iles = stubIle.RecupererIle();
// Assert
Assert.NotNull(iles);
}
[Fact]
public void RecupererIle_ContainsSpecificIle()
{
// Arrange
var stubIle = new StubIle();
// Act
var iles = stubIle.RecupererIle();
// Assert
var ile = iles.FirstOrDefault(i => i.Nom == "Dawn");
Assert.NotNull(ile);
Assert.True("Don-to"== ile.NomRomanise);
Assert.True("East Blue" == ile.Region);
// ... assert other properties
}
}
}

@ -0,0 +1,40 @@
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class StubPersonnageTests
{
[Fact]
public void RecupererPersonnage_ReturnsPersonnageList()
{
// Arrange
var stubPersonnage = new StubPersonnage();
// Act
var personnages = stubPersonnage.RecupererPersonnage();
// Assert
Assert.NotNull(personnages);
}
[Fact]
public void RecupererPersonnage_ContainsSpecificPersonnage()
{
var stubPersonnage = new StubPersonnage();
var personnages = stubPersonnage.RecupererPersonnage();
var luffy = personnages.FirstOrDefault(p => p.Nom == "Luffy");
Assert.NotNull(luffy);
Assert.True(3000000000== luffy.Prime);
Assert.True("Luffy au Chapeau de Paille" == luffy.Epithete);
Assert.True(19 == luffy.Age);
Assert.True(1.74 == luffy.Taille);
}
}
}

@ -1,4 +1,6 @@
using Model.Classes; using Model.Classes;
using Newtonsoft.Json.Bson;
using NuGet.Frameworks;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -23,5 +25,21 @@ namespace TestProject1
bool resultat = (test.Image == "baseimage.png"); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png"); Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
} }
[Fact]
public void ConstructeurBateau2_ImageEgaleValeurParDefaut_ReturnTrue()
{
Bateau test = new Bateau("Sunny", "Sauzando Sani-go", 435, 321, "Le Thousand Sunny est...", "Ce bateau a pour particularités ...","");
bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
}
[Fact]
public void SurchargeEqualsBateau_Bateau1EgaleBateau2()
{
Bateau bateau1 = new Bateau("Sunny", "Sauzando Sani-go", 435, 321, "Le Thousand Sunny est...", "Ce bateau a pour particularités ...", " ");
Bateau bateau2 = new Bateau("Sunny", "Sauzando Sani-go", 435, 321, "Le Thousand Sunny est...", "Ce bateau a pour particularités ...", " ");
bool resultat =(bateau1.Equals(bateau2));
Assert.True(resultat, "Les deux bateaux devraient etre égaux car ils onts le meme nom");
}
} }
} }

@ -16,5 +16,21 @@ namespace TestProject1
bool resultat = (test.Image == "baseimage.png"); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png"); Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
} }
[Fact]
public void ConstructeurBestiaire2_ImageEgaleValeurParDefaut_ReturnTrue()
{
Bestiaire test = new Bestiaire("Humains", "??", "Les humains sont ...", "Ils possèdent les caractéristiques suivantes ...","");
bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
}
[Fact]
public void SurchargeEqualsBestiaire_Bestiaire1EgaleBestiaire2()
{
Bestiaire bestiaire1 = new Bestiaire("Humains", "??", "Les humains sont ...", "Ils possèdent les caractéristiques suivantes ...", "");
Bestiaire bestiaire2 = new Bestiaire("Humains", "??", "Les humains sont ...", "Ils possèdent les caractéristiques suivantes ...", "");
bool resultat = (bestiaire1.Equals(bestiaire2));
Assert.True(resultat, "Les deux bestiaires devraient etre égaux car ils onts le meme nom");
}
} }
} }

@ -23,5 +23,21 @@ namespace TestProject1
bool resultat = (test.Image == "baseimage.png"); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png"); Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
} }
[Fact]
public void ConstructeurEquipage2_ImageEgaleValeurParDefaut_ReturnTrue()
{
Equipage test = new Equipage("Équipage du Roux", "Akagami Kalzokudan", "East Blue", -1, 0, true, "L'équipage du Roux ...","");
bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
}
[Fact]
public void SurchargeEqualsEquipage_Equipage1EgaleEquipage2()
{
Equipage equiapge1= new Equipage("Équipage du Roux", "Akagami Kalzokudan", "East Blue", -1, 0, true, "L'équipage du Roux ...", "");
Equipage equiapge2 = new Equipage("Équipage du Roux", "Akagami Kalzokudan", "East Blue", -1, 0, true, "L'équipage du Roux ...", "");
bool resultat = (equiapge1.Equals(equiapge2));
Assert.True(resultat, "Les deux equipages devraient etre égaux car ils onts le meme nom");
}
} }
} }

@ -12,16 +12,33 @@ namespace TestProject1
[Fact] [Fact]
public void FDD_PremierChapEtPremierEpSuperieurOuEgalAZero_ReturnTrue() public void FDD_PremierChapEtPremierEpSuperieurOuEgalAZero_ReturnTrue()
{ {
FruitDuDemon test = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", -5, -5, "Le Moku Moku no Mi, ou Fruit Fumigène en français, est un Fruit du Démon de type Logia qui transforme celui qui le mange en Homme-Fumée (煙人間, Kemuri Ningen). Il permet à son utilisateur de maîtriser, de produire à volonté et de se transformer en fumée. Ce fruit fut mangé par Smoker. Smoker est connu grâce à ce Fruit sous le surnom de \"Chasseur Blanc\".", "L'utilisateur de ce fruit a la capacité de générer, manipuler et devenir de la fumée. Comme la grande partie des utilisateurs de Logia, lorsque Smoker est touché, il peut tout simplement utiliser la capacité de son fruit pour se transformer en fumée, absorbant ainsi l'attaque et ne recevant alors aucun dégât. Comme certains Fruits du Démon de type Logia, il permet à Smoker de voler, en changeant la partie inférieure de son corps en fumée et en se propulsant, améliorant ainsi grandement sa mobilité et sa vitesse.\r\n\r\nLes principales qualités offensives du fruit proviennent de la capacité qu'il donne à son utilisateur de modifier la densité de la fumée qu'il produit à volonté. Ainsi, Smoker peut entourer sa cible de sa fumée intangible puis de la solidifier pour se saisir d'elle. Grâce à ce pouvoir, Smoker a reçu l'épithète: Le Chasseur Blanc. La fumée peut également être utilisée comme une arme pour frapper les ennemis avec puissance. Il est cependant possible d'échapper à l'emprise de la fumée avec un choc assez fort pour contrer cette force. ", "Il semblerait que lorsqu'il se retrouve confronté avec le feu (par exemple celui du pouvoir du Mera Mera no Mi), les deux pouvoirs s'annulent. A part cela, aucune faiblesse n'a encore été vue. Grâce à sa maîtrise instinctive de son pouvoir, le seul moyen sûr de le blesser est d'utiliser le Fluide, comme l'a fait Boa Hancock lors de leur courte altercation à Marineford ou d'utiliser les faiblesses habituelles des utilisateurs de Fruits du Démon, à savoir l'eau ou le Granit Marin."); FruitDuDemon test = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", 97, 48, "", "", "");
bool resultat = (test.PremierChap >= 0 && test.PremierEp >= 0); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "Les paramètre PremierChap et PremierEp doivent être supérieur ou égale à 0"); Assert.True(resultat, "Les paramètre PremierChap et PremierEp doivent être supérieur ou égale à 0");
} }
[Fact] [Fact]
public void ConstructeurFDD_ImageEgaleValeurParDefaut_ReturnTrue() public void ConstructeurFDD_ImageEgaleValeurParDefaut_ReturnTrue()
{ {
FruitDuDemon test = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", 97, 48, "Le Moku Moku no Mi, ou Fruit Fumigène en français, est un Fruit du Démon de type Logia qui transforme celui qui le mange en Homme-Fumée (煙人間, Kemuri Ningen). Il permet à son utilisateur de maîtriser, de produire à volonté et de se transformer en fumée. Ce fruit fut mangé par Smoker. Smoker est connu grâce à ce Fruit sous le surnom de \"Chasseur Blanc\".", "L'utilisateur de ce fruit a la capacité de générer, manipuler et devenir de la fumée. Comme la grande partie des utilisateurs de Logia, lorsque Smoker est touché, il peut tout simplement utiliser la capacité de son fruit pour se transformer en fumée, absorbant ainsi l'attaque et ne recevant alors aucun dégât. Comme certains Fruits du Démon de type Logia, il permet à Smoker de voler, en changeant la partie inférieure de son corps en fumée et en se propulsant, améliorant ainsi grandement sa mobilité et sa vitesse.\r\n\r\nLes principales qualités offensives du fruit proviennent de la capacité qu'il donne à son utilisateur de modifier la densité de la fumée qu'il produit à volonté. Ainsi, Smoker peut entourer sa cible de sa fumée intangible puis de la solidifier pour se saisir d'elle. Grâce à ce pouvoir, Smoker a reçu l'épithète: Le Chasseur Blanc. La fumée peut également être utilisée comme une arme pour frapper les ennemis avec puissance. Il est cependant possible d'échapper à l'emprise de la fumée avec un choc assez fort pour contrer cette force. ", "Il semblerait que lorsqu'il se retrouve confronté avec le feu (par exemple celui du pouvoir du Mera Mera no Mi), les deux pouvoirs s'annulent. A part cela, aucune faiblesse n'a encore été vue. Grâce à sa maîtrise instinctive de son pouvoir, le seul moyen sûr de le blesser est d'utiliser le Fluide, comme l'a fait Boa Hancock lors de leur courte altercation à Marineford ou d'utiliser les faiblesses habituelles des utilisateurs de Fruits du Démon, à savoir l'eau ou le Granit Marin."); FruitDuDemon test = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", 97, 48, "", "", "");
bool resultat = (test.Image == "baseimage.png"); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png"); Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
} }
[Fact]
public void ConstructeurFDD2_ImageEgaleValeurParDefaut_ReturnTrue()
{
FruitDuDemon test = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", 97, 48, "", "", "","");
bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
}
[Fact]
public void SurchargeEqualsFDD_FDD1EgaleFDD2()
{
FruitDuDemon fruit1 = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", 97, 48, "", "", "", "");
FruitDuDemon fruit2 = new FruitDuDemon("Fruit de la fumée", "Moku Moku No Mi", "Logia", 97, 48, "", "", "", "");
bool resultat = (fruit1.Equals(fruit2));
Assert.True(resultat, "Les deux fruits du démon devraient etre égaux car ils onts le meme nom");
}
} }
} }

@ -23,5 +23,20 @@ namespace TestProject1
bool resultat = (test.Image == "baseimage.png"); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png"); Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
} }
[Fact]
public void ConstructeurIle2_ImageEgaleValeurParDefaut_ReturnTrue()
{
Ile test = new Ile("Dawn", "Don-to", "East Blue", 1, 4, "L'île de Dawn est ...", "Cette île est situé dans la mer d'East Blue près de ...","");
bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
}
[Fact]
public void SurchargeEqualsIle_Ile1EgaleIle2()
{
Ile ile1 = new Ile("Dawn", "Don-to", "East Blue", 1, 4, "L'île de Dawn est ...", "Cette île est situé dans la mer d'East Blue près de ...", "");
Ile ile2 = new Ile("Dawn", "Don-to", "East Blue", 1, 4, "L'île de Dawn est ...", "Cette île est situé dans la mer d'East Blue près de ...", "");
bool resultat = (ile1.Equals(ile2));
Assert.True(resultat, "Les iles devraient etre égales car ils onts le meme nom");
}
} }
} }

@ -16,6 +16,14 @@ namespace TestProject1
bool resultat = (test.Image == "baseimage.png"); bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png"); Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
} }
[Fact]
public void ConstructeurPersonnage2_ImageEgaleValeurParDefaut_ReturnTrue()
{
Personnage test = new Personnage("Luffy", 3000000000, "Luffy au Chapeau de Paille", 19, 1.74, "East Blue", "Monkey D. Luffy est...", "Le Roi des Pirates, ce sera moi !","");
bool resultat = (test.Image == "baseimage.png");
Assert.True(resultat, "L'image devrait avoir la valeur : baseimage.png");
}
[Fact] [Fact]
public void Personnage_PrimeSuperieurOuEgalAZero_ReturnTrue() public void Personnage_PrimeSuperieurOuEgalAZero_ReturnTrue()
{ {
@ -30,5 +38,13 @@ namespace TestProject1
bool resultat = (test.Taille >= 0); bool resultat = (test.Taille >= 0);
Assert.True(resultat, "La taille du personnage doit avoir une valeur positive"); Assert.True(resultat, "La taille du personnage doit avoir une valeur positive");
} }
[Fact]
public void SurchargeEqualsPersonnage_Personnage1EgalePersonnage2()
{
Personnage personnage1 = new Personnage("Luffy", 3000000000, "Luffy au Chapeau de Paille", 19, -1, "East Blue", "Monkey D. Luffy est...", "Le Roi des Pirates, ce sera moi !", "luffy.png");
Personnage personnage2 = new Personnage("Luffy", 3000000000, "Luffy au Chapeau de Paille", 19, -1, "East Blue", "Monkey D. Luffy est...", "Le Roi des Pirates, ce sera moi !", "luffy.png");
bool resultat = (personnage1.Equals(personnage1));
Assert.True(resultat, "Les personanges devraient etre égales car ils onts le meme nom");
}
} }
} }

Loading…
Cancel
Save