Merge branch 'devYoan'
continuous-integration/drone/push Build is passing Details

devGuillaume
Yoan 2 years ago
commit bacbb78ded

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
@ -10,15 +12,16 @@ namespace Model.Classes
{
[DataContract(Name = "bateau")]
public class Bateau : ObjetOhara
{
{
[DataMember(Name = "nomromanise")]
private string nomromanise;
public string NomRomanise {
private string? nomromanise;
public string? NomRomanise {
get=>nomromanise;
set
{
{
if(nomromanise == value) return;
nomromanise = value;
OnPropertyChanged();
}
}
[DataMember(Name = "affiliation", EmitDefaultValue = false)]
@ -29,6 +32,7 @@ namespace Model.Classes
{
if(equipage == value) return;
equipage = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierchap")]
@ -40,6 +44,7 @@ namespace Model.Classes
{
if (premierchap == value) return;
premierchap = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierep")]
@ -51,37 +56,42 @@ namespace Model.Classes
{
if (premierep == value) return;
premierep = value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")]
private string description;
public string Description
private string? description;
public string? Description
{
get => description;
set
{
{
if (description == value) return;
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "caracteristique")]
private string caracteristique;
public string Caracteristique {
private string? caracteristique;
public string? Caracteristique {
get=> caracteristique;
set
{
if(caracteristique == value) return;
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)
{
NomRomanise = nomRomanise;
if (String.IsNullOrEmpty(nomRomanise))
NomRomanise = "";
else
NomRomanise = nomRomanise;
if (premierEp < 0)
{
PremierEp = 0;
@ -90,28 +100,33 @@ namespace Model.Classes
{
PremierEp = premierEp;
}
if (premierChap < 0)
if (premierChap < 0 )
{
premierChap = 0;
PremierChap = 0;
}
else
{
PremierChap = premierChap;
}
Description = description;
Caracteristique = caracteristique;
if (String.IsNullOrEmpty(description))
Description = "Description du bateau ...";
else
Description = description;
if (String.IsNullOrEmpty(caracteristique))
Caracteristique = "Caracteristiques du bateau ...";
else
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)
{
if (String.IsNullOrEmpty(image))
image = "baseimage.png";
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)
{
@ -136,7 +151,9 @@ namespace Model.Classes
public override string ToString()
{
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
{
[DataContract(Name = "bestiaire")]
public class Bestiaire : ObjetOhara, INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public class Bestiaire : ObjetOhara
{
[DataMember(Name = "origine")]
private string origine;
public string Origine {
private string? origine;
public string? Origine {
get=>origine;
set
{
@ -28,8 +26,8 @@ namespace Model.Classes
}
}
[DataMember(Name = "description")]
private string description;
public string Description {
private string? description;
public string? Description {
get=>description;
set
{
@ -39,8 +37,8 @@ namespace Model.Classes
}
}
[DataMember(Name = "caracteristique")]
private string caracteristique;
public string Caracteristique {
private string? caracteristique;
public string? Caracteristique {
get=>caracteristique;
set
{
@ -52,13 +50,21 @@ namespace Model.Classes
public Bestiaire(string nom, string origine, string description, string caracteristique) : base(nom)
{
if (String.IsNullOrEmpty(origine))
origine = "Grand Line";
Origine = origine;
if (String.IsNullOrEmpty(description))
description = "Pour décrire ...";
Description = description;
if (String.IsNullOrEmpty(caracteristique))
caracteristique = "Les caracteristiques ...";
Caracteristique = 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;
}
public override bool Equals(object? obj)
@ -75,18 +81,13 @@ namespace Model.Classes
}
}
public override int GetHashCode()
{
return HashCode.Combine(Origine, Description, Caracteristique);
}
public override string ToString()
{
return "Bestiaire :" + Nom +" "+EstFavori+ " " + Origine + " " + Description + " " + Caracteristique +" " + Image;
}
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
return "Bestiaire : " + Nom +" "+EstFavori+ " " + Origine + " " + Description + " " + Caracteristique +" " + Image;
}
}
}

@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
@ -12,24 +15,107 @@ namespace Model.Classes
public class Equipage : ObjetOhara
{
[DataMember(Name = "nomromanise")]
public string NomRomanise { get; set; }
private string? nomromanise;
public string? NomRomanise
{
get => nomromanise;
set
{
nomromanise = value;
OnPropertyChanged();
}
}
[DataMember(Name = "region")]
public string Region { get; set; }
private string? region;
public string? Region {
get=> region;
set
{
region = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierchap")]
public int PremierChap { get; set; }
private int premierchap;
public int PremierChap {
get=>premierchap;
set
{
premierchap = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierep")]
public int PremierEp { get; set; }
private int premierep;
public int PremierEp {
get=>premierep;
set
{
premierep = value;
OnPropertyChanged();
}
}
[DataMember(Name = "statut")]
public bool Statut { get; set; }
private bool statut;
public bool Statut {
get=>statut;
set
{
statut = value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")]
public string Description { get; set; }
private string? description;
public string? Description {
get=>description;
set
{
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "capitaine")]
public Personnage? Capitaine { get; set; }
private Personnage? capitaine;
public Personnage? Capitaine {
get=>capitaine;
set
{
capitaine = value;
OnPropertyChanged();
}
}
[DataMember(Name = "membre")]
public List<Personnage> Membre { get; set; } = new List<Personnage>();
private ObservableCollection<Personnage> membre = new ObservableCollection<Personnage>();
public IReadOnlyCollection<Personnage> Membre { get=>membre; }
public void AjouterMembre(Personnage? p)
{
if(p!=null) membre.Add(p);
}
public void RetirerMembre(Personnage? p)
{
if(p!=null) membre.Remove(p);
}
public void ViderMembre() => membre.Clear();
[DataMember(Name = "allie")]
public List<Equipage> Allie { get; set; } = new List<Equipage>();
private ObservableCollection<Equipage> allie = new ObservableCollection<Equipage>();
public IReadOnlyCollection<Equipage> Allie { get => allie; }
public void AjouterAllie(Equipage? p)
{
if (p != null) allie.Add(p);
}
public void RetirerAllie(Equipage? p)
{
if (p != null) allie.Remove(p);
}
public void ViderAllie() => allie.Clear();
public Equipage(string nom, string nomRomanise, string region, int premierChap, int premierEp, bool statut, string description) : base(nom)
{
@ -59,7 +145,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)
{
if (String.IsNullOrWhiteSpace(image))
{
image = "baseimage.png";
}
Image = image;
}
@ -87,7 +176,7 @@ namespace Model.Classes
public override string ToString()
{
return "Equipage :" + Nom +" "+EstFavori+ " " + NomRomanise + " " + Region + " " + PremierChap + " " + PremierEp + " " + Statut + " " + Description + " " + Image;
}
return "Equipage : " + Nom +" "+EstFavori+ " " + NomRomanise + " " + Region + " " + PremierChap + " " + PremierEp + " " + Statut + " " + Description + " " + Image;
}
}
}

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
@ -10,27 +11,82 @@ using System.Xml.Linq;
namespace Model.Classes
{
[DataContract(Name = "fruitdudemon")]
public class FruitDuDemon : ObjetOhara,INotifyPropertyChanged
public class FruitDuDemon : ObjetOhara
{
[DataMember(Name = "nomromanise")]
public string NomRomanise { get; set; }
private string? nomromanise;
public string? NomRomanise {
get=>nomromanise;
set
{
nomromanise = value;
OnPropertyChanged();
}
}
[DataMember(Name = "type")]
public string Type { get; set; }
private string? type;
public string? Type {
get=>type;
set
{
type = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierchap")]
public int PremierChap { get; set; }
private int premierchap;
public int PremierChap {
get=>premierchap;
set
{
premierchap = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierep")]
public int PremierEp { get; set; }
private int premierep;
public int PremierEp {
get=>premierep;
set
{
premierep=value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")]
public string Description { get; set; }
private string? description;
public string? Description {
get=>description;
set
{
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "forces")]
public string Forces { get; set; }
private string? forces;
public string? Forces {
get=>forces;
set
{
forces = value;
OnPropertyChanged();
}
}
[DataMember(Name = "faiblesses")]
public string Faiblesses { get; set; }
private string? faiblesses;
public string? Faiblesses {
get=>faiblesses;
set
{
faiblesses = value;
OnPropertyChanged();
}
}
[DataMember(Name = "utilisateur", EmitDefaultValue = false)]
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)
{
@ -46,7 +102,7 @@ namespace Model.Classes
}
if (premierChap < 0)
{
premierChap = 0;
PremierChap = 0;
}
else
{
@ -59,17 +115,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)
{
if (String.IsNullOrWhiteSpace(image))
image = "baseimage.png";
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)
{
if (obj == null) return false;
@ -92,15 +141,7 @@ namespace Model.Classes
}
public override string ToString()
{
return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image;
}
void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
return "FruitDuDemon : " + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image;
}
}
}

@ -11,31 +11,26 @@ using System.Xml.Linq;
namespace Model.Classes
{
[DataContract(Name = "ile")]
public class Ile : ObjetOhara, INotifyPropertyChanged
public class Ile : ObjetOhara
{
public event PropertyChangedEventHandler? PropertyChanged;
[DataMember(Name = "nomromanise")]
private string nomromanise;
public string NomRomanise
private string? nomromanise;
public string? NomRomanise
{
get => nomromanise;
set
{
if (nomromanise == value) return;
nomromanise = value;
OnPropertyChanged();
}
}
[DataMember(Name = "region")]
private string region;
public string Region {
private string? region;
public string? Region {
get=>region;
set
{
if (region == value) return;
region = value;
OnPropertyChanged();
}
@ -46,7 +41,6 @@ namespace Model.Classes
get=>premierchap;
set
{
if(premierchap == value) return;
premierchap = value;
OnPropertyChanged();
}
@ -57,29 +51,26 @@ namespace Model.Classes
get=>premierep;
set
{
if(premierep == value) return;
premierep = value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")]
private string description;
public string Description {
private string? description;
public string? Description {
get=>description;
set
{
if (description == value) return;
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "geographie")]
private string geographie;
public string Geographie {
private string? geographie;
public string? Geographie {
get=>geographie;
set
{
if (geographie == value) return;
geographie = value;
OnPropertyChanged();
}
@ -89,8 +80,11 @@ namespace Model.Classes
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;
if (String.IsNullOrWhiteSpace(region))
region = "Grand Line";
Region = region;
if (premierEp < 0)
{
@ -102,20 +96,26 @@ namespace Model.Classes
}
if (premierChap < 0)
{
premierChap = 0;
PremierChap = 0;
}
else
{
PremierChap = premierChap;
}
if (String.IsNullOrWhiteSpace(description))
description = "Description de l'île ...";
Description = description;
if (String.IsNullOrWhiteSpace(geographie))
geographie = "Situation géographique de l'ile...";
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)
{
if(String.IsNullOrWhiteSpace(image)) {
image = "baseimage.png";
}
Image = image;
}
@ -142,10 +142,7 @@ namespace Model.Classes
public override string ToString()
{
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,16 +16,11 @@ namespace Model.Classes
public event PropertyChangedEventHandler? PropertyChanged;
[DataMember(Name = "nom")]
private string nom;
public string Nom {
private string? nom;
public string? Nom {
get => nom;
set
{
if (nom == value)
{
return;
}
{
nom = value;
OnPropertyChanged();
}
@ -36,10 +31,7 @@ namespace Model.Classes
public string? Image {
get => image;
set
{
if (image == value)
return;
{
image = value;
OnPropertyChanged();
@ -51,9 +43,7 @@ namespace Model.Classes
public bool EstFavori {
get=>estfavori;
set
{
if (estfavori == value)
return;
{
estfavori = value;
}
}
@ -92,10 +82,10 @@ namespace Model.Classes
}
public override string ToString()
{
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));
}
}

@ -1,4 +1,7 @@
using System.Runtime.Serialization;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace Model.Classes
{
@ -11,24 +14,17 @@ namespace Model.Classes
public double Prime {
get=>prime;
set
{
if (prime == value)
{
return;
}
{
prime = value;
OnPropertyChanged();
}
}
[DataMember(Name = "epithete")]
private string epithete;
public string Epithete {
private string? epithete;
public string? Epithete {
get=>epithete;
set
{
if (epithete == value)
{
return;
}
{
epithete = value;
}
}
@ -38,11 +34,8 @@ namespace Model.Classes
get=>age;
set
{
if (age == value)
{
return;
}
age = value;
OnPropertyChanged();
}
}
[DataMember(Name = "taille")]
@ -51,69 +44,67 @@ namespace Model.Classes
get=>taille;
set
{
if (taille == value)
{
return;
}
taille = value;
OnPropertyChanged();
}
}
[DataMember(Name = "origine")]
private string origine;
public string Origine {
private string? origine;
public string? Origine {
get=>origine;
set
{
if (origine == value)
{
return;
}
origine = value;
OnPropertyChanged();
}
}
[DataMember(Name = "biographie")]
private string biographie;
public string Biographie {
private string? biographie;
public string? Biographie {
get=>biographie;
set
{
if (biographie == value)
{
return;
}
biographie = value;
OnPropertyChanged();
}
}
[DataMember(Name = "citation")]
private string citation;
public string Citation {
private string? citation;
public string? Citation {
get=>citation;
set
{
if (citation == value)
{
return;
}
citation = value;
OnPropertyChanged();
}
}
[DataMember(Name = "equipage", EmitDefaultValue = false)]
private Equipage equipage;
public Equipage Equipage {
private Equipage? equipage;
public Equipage? Equipage {
get => equipage;
set
{
if (equipage == value)
{
return;
}
equipage = value;
OnPropertyChanged();
}
}
[DataMember(Name = "fruit", EmitDefaultValue = false)]
public List<FruitDuDemon> Fruit { get; set; } = new List<FruitDuDemon>();
private ObservableCollection<FruitDuDemon> fruit = new ObservableCollection<FruitDuDemon>();
public IReadOnlyCollection<FruitDuDemon> Fruit {
get=>fruit;
}
public void AjouterFruit(FruitDuDemon? f)
{
if (f == null) return;
fruit.Add(f);
}
public void RetierFruit(FruitDuDemon? f)
{
if (f == null) return;
fruit.Remove(f);
}
public void ViderFruit() => fruit.Clear();
public Personnage(string nom, double prime, string epithete, int age, double taille, string origine, string biographie, string citation) : base(nom)
@ -146,15 +137,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)
{
if (String.IsNullOrWhiteSpace(image))
image = "baseimage.png";
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)
{
if (obj == null) return false;
@ -172,13 +158,12 @@ namespace Model.Classes
public override int GetHashCode()
{
return HashCode.Combine(Prime, Epithete, Age, Origine,Biographie, Citation,Equipage,Fruit);
}
public override string ToString()
{
return "Personnage :" + Nom + " " + EstFavori + " " + Prime + " " + Epithete + " " + Age + " " + Origine + " " + Biographie + " "+ Citation+" " +Equipage+" " + Fruit+" "+ Image;
return "Personnage : " + Nom + " " + EstFavori + " " + Prime + " " + Epithete + " " + Age + " " + Origine + " " + Biographie + " "+ Citation+" " +Equipage+" " + Fruit+" "+ Image;
}
}
}

@ -83,12 +83,6 @@ namespace Model.Managers
return ile;
}
public List<ObjetOhara> FiltrerFavs(string type)
{
List<ObjetOhara> favs = GetFavoris();
return favs;
}
public List<ObjetOhara> RechercheObjetOhara(string text, List<ObjetOhara> liste)
{
if (text == "")
@ -99,7 +93,7 @@ namespace Model.Managers
{
bool correspondance = false;
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))
{
@ -138,128 +132,134 @@ namespace Model.Managers
return listeFavoris;
}
public void ModifierFavFDD(FruitDuDemon fruit,bool value)
public void ModifierFavFDD(FruitDuDemon fruit, bool value)
{
foreach (FruitDuDemon b in Fruits)
FruitDuDemon? fruitToUpdate = Fruits.FirstOrDefault(b => b.Equals(fruit));
if (fruitToUpdate != null)
{
if (b.Equals(fruit))
{
b.EstFavori = value;
DataManager.SetFDD(Fruits.ToList());
}
fruitToUpdate.EstFavori = value;
DataManager.SetFDD(Fruits.ToList());
}
}
public void ModifierFavEquip(Equipage equip, bool value)
{
foreach (Equipage b in Equipages)
Equipage? equipToUpdate = Equipages.FirstOrDefault(e => e.Equals(equip));
if (equipToUpdate != null)
{
if (b.Equals(equip))
{
b.EstFavori = value;
DataManager.SetEquipage(Equipages.ToList());
}
equipToUpdate.EstFavori = value;
DataManager.SetEquipage(Equipages.ToList());
}
}
public void ModifierFavBest(Bestiaire best, bool value)
{
foreach (Bestiaire b in Bestiaire)
Bestiaire? bestToUpdate = Bestiaire.FirstOrDefault(b => b.Equals(best));
if (bestToUpdate != null)
{
if (b.Equals(best))
{
b.EstFavori = value;
DataManager.SetBestiaire(Bestiaire.ToList());
}
bestToUpdate.EstFavori = value;
DataManager.SetBestiaire(Bestiaire.ToList());
}
}
public void ModifierFavPerso(Personnage perso, bool value)
{
foreach (Personnage b in Personnages)
Personnage? persoToUpdate = Personnages.FirstOrDefault(p => p.Equals(perso));
if (persoToUpdate != null)
{
if (b.Equals(perso))
{
b.EstFavori = value;
DataManager.SetPersonnage(Personnages.ToList());
}
persoToUpdate.EstFavori = value;
DataManager.SetPersonnage(Personnages.ToList());
}
}
public void ModifierFavIle(Ile ile, bool value)
{
foreach (Ile b in Iles)
Ile? ileToUpdate = Iles.FirstOrDefault(i => i.Equals(ile));
if (ileToUpdate != null)
{
if (b.Equals(ile))
{
b.EstFavori = value;
DataManager.SetIle(Iles.ToList());
}
ileToUpdate.EstFavori = value;
DataManager.SetIle(Iles.ToList());
}
}
public void ModifierFavBateau(Bateau bateau, bool value)
{
foreach (Bateau b in Bateaux)
Bateau? bateauToUpdate = Bateaux.FirstOrDefault(b => b.Equals(bateau));
if (bateauToUpdate != null)
{
if (b.Equals(bateau))
{
b.EstFavori = value;
DataManager.SetBateau(Bateaux.ToList());
}
bateauToUpdate.EstFavori = value;
DataManager.SetBateau(Bateaux.ToList());
}
}
public void AjouterFDD(FruitDuDemon fruit)
{
Fruits.Add(fruit);
DataManager.SetFDD(Fruits.ToList());
}
public void AjouterEquip(Equipage equip)
{
Equipages.Add(equip);
DataManager.SetEquipage(Equipages.ToList());
}
public void AjouterBest(Bestiaire best)
{
Bestiaire.Add(best);
DataManager.SetBestiaire(Bestiaire.ToList());
}
public void AjouterPerso(Personnage perso)
{
Personnages.Add(perso);
DataManager.SetPersonnage(Personnages.ToList());
}
public void AjouterIle(Ile ile)
{
Iles.Add(ile);
DataManager.SetIle(Iles.ToList());
}
public void AjouterBateau(Bateau bateau)
{
Bateaux.Add(bateau);
DataManager.SetBateau(Bateaux.ToList());
}
public void SupprimerFDD(FruitDuDemon fruit)
{
Fruits.Remove(fruit);
DataManager.SetFDD(Fruits.ToList());
}
public void SupprimerEquip(Equipage equip)
{
Equipages.Remove(equip);
DataManager.SetEquipage(Equipages.ToList());
}
public void SupprimerBest(Bestiaire best)
{
Bestiaire.Remove(best);
DataManager.SetBestiaire(Bestiaire.ToList());
}
public void SupprimerPerso(Personnage perso)
{
Personnages.Remove(perso);
DataManager.SetPersonnage(Personnages.ToList());
}
public void SupprimerIle(Ile ile)
{
Iles.Remove(ile);
DataManager.SetIle(Iles.ToList());
}
public void SupprimerBateau(Bateau bateau)
{
Bateaux.Remove(bateau);
DataManager.SetBateau(Bateaux.ToList());
}
public void ModifierIle(Ile ile, string ancienNom)
{
Ile? ancienneIle = Iles.FirstOrDefault(p => p.Nom == ancienNom);
if (ancienneIle == null) return;
Iles.Remove(ancienneIle);
Iles.Add(ile);
if(ancienneIle !=null) {
Iles.Remove(ancienneIle);
Iles.Add(ile);
DataManager.SetIle(Iles.ToList());
}
}
public void ModifierBest(Bestiaire best, string ancienNom)
{
@ -267,6 +267,7 @@ namespace Model.Managers
if (ancienBest == null) return;
Bestiaire.Remove(ancienBest);
Bestiaire.Add(best);
DataManager.SetBestiaire(Bestiaire.ToList());
}
public void ModifierEquipage(Equipage equip, string ancienNom)
{
@ -274,6 +275,7 @@ namespace Model.Managers
if (ancienEquip == null) return;
Equipages.Remove(ancienEquip);
Equipages.Add(equip);
DataManager.SetEquipage(Equipages.ToList());
}
public void ModifierBateau(Bateau bateau, string ancienNom)
@ -282,6 +284,7 @@ namespace Model.Managers
if (ancienBateau == null) return;
Bateaux.Remove(ancienBateau);
Bateaux.Add(bateau);
DataManager.SetBateau(Bateaux.ToList());
}
public void ModifierFDD(FruitDuDemon fruit, string ancienNom)
{
@ -289,6 +292,15 @@ namespace Model.Managers
if (ancienFDD == null) return;
Fruits.Remove(ancienFDD);
Fruits.Add(fruit);
DataManager.SetFDD(Fruits.ToList());
}
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);
DataManager.SetPersonnage(Personnages.ToList());
}
}
}

@ -18,57 +18,37 @@ namespace Model.Serializer
{
StubManager stubManager = new StubManager();
Chemin = Directory.GetCurrentDirectory();
if (File.Exists(Path.Combine(Chemin, "./personnage.xml"))==false)
{
SetPersonnage(stubManager.GetPersonnages().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false)
{
SetBateau(stubManager.GetBateaux().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false)
{
SetFDD(stubManager.GetFruits().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false)
{
SetBestiaire(stubManager.GetBestiaires().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false)
{
SetEquipage(stubManager.GetEquipages().ToList());
}
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false)
{
SetIle(stubManager.GetIles().ToList());
}
InitialiserFichiers(stubManager);
}
public XML_Serializer(string path)
{
Chemin= path;
StubManager stubManager = new StubManager();
if (File.Exists(Path.Combine(Chemin, "./personnage.xml")) == false)
InitialiserFichiers(stubManager);
}
public void InitialiserFichiers(StubManager stubManager)
{
if (!File.Exists(Path.Combine(Chemin, "./personnage.xml")))
{
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());
}
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false)
if (!File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")))
{
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());
}
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false)
if (!File.Exists(Path.Combine(Chemin, "./equipage.xml")))
{
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());
}

@ -9,7 +9,7 @@ namespace Model.Stub
{
public class StubEquipage
{
public List<Equipage> Equipages { get; set; }
public List<Equipage>? Equipages { get; set; }
public void ChargerEquipage(List<Personnage> persos)
{
@ -18,7 +18,7 @@ namespace Model.Stub
var clown = new Equipage("Équipage du Clown", "Bagï Kalzokudan", "East Blue", 8, 4, true, "L'équipage du Clown ...", "clown.png");
var blanche = new Equipage("Équipage de Barbe Blanche", "Shirohige Kaizokudan", "East Blue", 234, 151, true, "L'équipage de Barbe Blanche ...", "blanche.jpg");
var noire = new Equipage("Équipage de Barbe Noire", "Kurohige Kaizokudan", "East Blue", 234, 151, true, "L'équipage de Barbe Noire ...", "noire.png");
paille.Allie.Add(clown);
paille.AjouterAllie(clown);
paille = RemplirEquipage(paille, persos, new List<string> { "Luffy" });
Equipages = new List<Equipage>()
{
@ -26,9 +26,7 @@ namespace Model.Stub
roux,
clown,
blanche,
};
};
}
public IEnumerable<Equipage> RecupererEquipage()
{
@ -38,10 +36,10 @@ namespace Model.Stub
public Equipage RemplirEquipage(Equipage equipage,List<Personnage> persos,List<string> noms)
{
var persos2 = persos.Where(p => noms.Contains(p.Nom));
equipage.Membre.AddRange(persos2);
foreach (Personnage p in persos2)
equipage.AjouterMembre(p);
return equipage;
}
}
}

@ -60,32 +60,32 @@ namespace Model.Stub
public void SetBateau(List<Bateau> listeBateaux)
{
throw new NotImplementedException();
return;
}
public void SetBestiaire(List<Bestiaire> listeBest)
{
throw new NotImplementedException();
return;
}
public void SetEquipage(List<Equipage> listeEquip)
{
throw new NotImplementedException();
return;
}
public void SetFDD(List<FruitDuDemon> listeFDD)
{
throw new NotImplementedException();
return;
}
public void SetIle(List<Ile> listeIle)
{
throw new NotImplementedException();
return;
}
public void SetPersonnage(List<Personnage> listePerso)
{
throw new NotImplementedException();
return;
}
}
}

@ -26,8 +26,8 @@ namespace Model.Stub
List<FruitDuDemon> fruits = new List<FruitDuDemon>(stubFruitDuDemon.RecupererFruit());
luffy.Fruit.AddRange(fruits.Where(p => p.Nom == "Fruit de l'humain modèle Nika"));
robin.Fruit.AddRange(fruits.Where(p => p.Nom == "Fruit des Éclosions"));
luffy.AjouterFruit(fruits.FirstOrDefault(p => p.Nom == "Fruit de l'humain modèle Nika"));
robin.AjouterFruit(fruits.FirstOrDefault(p => p.Nom == "Fruit des Éclosions"));
List<Personnage> persos = new List<Personnage>()

@ -4,11 +4,12 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Ohara"
xmlns:icon="clr-namespace:Ohara.Resources"
FlyoutBackgroundColor="White"
Shell.FlyoutBehavior="Locked"
Shell.NavBarIsVisible="False"
>
<Shell.Resources>
<Style TargetType="Layout"
ApplyToDerivedTypes="True"
@ -16,7 +17,7 @@
<Setter Property="WidthRequest" Value="1000"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="White"/>
@ -25,10 +26,15 @@
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#72a3b3"/>
<Setter Property="BackgroundColor" Value="#bfe5ef"/>
</VisualState.Setters>
</VisualState>
<!--<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#72a3b3"/>
</VisualState.Setters>
</VisualState>-->
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
@ -42,18 +48,23 @@
<Setter Property="WidthRequest" Value="1000"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="TextColor" Value="#72a3b3"/>
<Setter Property="FontSize" Value="15"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<!--<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Property="TextColor" Value="White"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Property="TextColor" Value="White"/>
</VisualState.Setters>
</VisualState>-->
</VisualStateGroup>
</VisualStateGroupList>
@ -77,47 +88,88 @@
</Shell.FlyoutHeader>
<FlyoutItem Title="Accueil" >
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Acceuil}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" />
</FlyoutItem>
<FlyoutItem Title="Favoris">
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="\ue72c"
Glyph="{x:Static icon:IconFont.Fav}"
Color="#72a3b3"
Size="16"/>
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PageFavoris}" />
</FlyoutItem>
<FlyoutItem Title="Carte">
<ShellContent ContentTemplate="{DataTemplate local:PageCarte}" />
</FlyoutItem>
<FlyoutItem Title="Personnages">
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Perso}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PagePersonnage}" />
</FlyoutItem>
<FlyoutItem Title="Bateaux">
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Bateau}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PageBateau}" />
</FlyoutItem>
<FlyoutItem Title="Îles" >
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Ile}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PageIle}" />
</FlyoutItem>
<FlyoutItem Title="Fruits Du Démon">
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Fdd}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PageFDD}" />
</FlyoutItem>
<FlyoutItem Title="Equipages">
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Equip}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PageEquipage}" />
</FlyoutItem>
<FlyoutItem Title="Bestiaire">
<FlyoutItem.Icon>
<FontImageSource
FontFamily="Icons"
Glyph="{x:Static icon:IconFont.Best}"
Color="#72a3b3"
Size="64"/>
</FlyoutItem.Icon>
<ShellContent ContentTemplate="{DataTemplate local:PageBestiaire}" />
</FlyoutItem>
<Shell.FlyoutFooter>
<StackLayout>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="4" Stroke="#72a3b3"/>

@ -4,28 +4,53 @@
x:Class="Ohara.MainPage"
BackgroundColor="#e2edf1">
<ScrollView>
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Spacing="40" Margin="0,20,0,0">
<Frame CornerRadius="20" HorizontalOptions="Center" Padding="30" BorderColor="Transparent">
<Label Text="Bienvenue dans Ohara !" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" TextColor="White"/>
<Frame.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#cdffd8" Offset="0.1" />
<GradientStop Color="#94b9ff" Offset="1.0" />
</LinearGradientBrush>
</Frame.Background>
</Frame>
<Frame CornerRadius="20" Padding="20" HorizontalOptions="Center" BackgroundColor="#72a3b3" BorderColor="#72a3b3" Margin="50">
<VerticalStackLayout Spacing="10">
<Label Text="Présentation :" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" VerticalOptions="Start" TextColor="White"/>
<Label TextColor="White" Grid.Column="1" FontSize="17" VerticalOptions="Center" HorizontalTextAlignment="Center" >
<Label.Text>
Ohara est le nom d'une île dans le manga One Piece, écrit par Eiichiro Oda. Cette île abritait de nombreux archéologues qui cherchaient à déceler les mystères du monde.
Nous avons choisi le nom Ohara pour notre projet lié à la SAE 2.01, car notre application représente une véritable encyclopédie rassemblant des informations sur One Piece.
Avec des centaines de personnages, des dizaines d'îles et de nombreux arcs d'histoire, il peut être difficile de se souvenir de tous les détails. Notre application a été conçue pour aider les fans à accéder facilement à toutes les informations sur One Piece,en offrant une expérience utilisateur fluide et intuitive.
</Label.Text>
</Label>
<VerticalStackLayout Spacing="50" Padding="30">
<Grid HeightRequest="500" HorizontalOptions="Center" MaximumWidthRequest="1000" >
<Frame CornerRadius="25"
BorderColor="Transparent"
BackgroundColor="Black"
IsClippedToBounds="True"
Padding="0">
<Image Source="ohara.jpg" Opacity="0.6" Aspect="Fill"/>
</Frame>
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Start" Margin="20" Spacing="10">
<Label Text="Bienvenue dans Ohara !" FontSize="27" HorizontalTextAlignment="Center" TextColor="White"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="White" />
</VerticalStackLayout>
</Frame>
<VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center" Spacing="5">
<Label Text="Inventaire de votre bibliothèque :" TextColor="White" FontSize="17" FontAttributes="Bold"/>
<Label Text="{Binding Personnages.Count, StringFormat=' {0} Personnages'}" TextColor="White" FontSize="17" HorizontalTextAlignment="Center"/>
<Label Text="{Binding Bateaux.Count, StringFormat=' {0} Bateaux'}" TextColor="White" FontSize="17" HorizontalTextAlignment="Center"/>
<Label Text="{Binding Iles.Count, StringFormat=' {0} Îles'}" TextColor="White" FontSize="17" HorizontalTextAlignment="Center"/>
<Label Text="{Binding Fruits.Count, StringFormat=' {0} Fruit du démons'}" TextColor="White" FontSize="17" HorizontalTextAlignment="Center"/>
<Label Text="{Binding Equipages.Count, StringFormat=' {0} Equipages'}" TextColor="White" FontSize="17" HorizontalTextAlignment="Center"/>
<Label Text="{Binding Bestiaire.Count, StringFormat=' {0} Bestiaires'}" TextColor="White" FontSize="17" HorizontalTextAlignment="Center"/>
</VerticalStackLayout>
<Label Text="Apprenez-en davantage sur le monde de One Piece et remplissez votre bibliothèque !" TextColor="White" FontSize="17" FontAttributes="Bold" VerticalOptions="End" HorizontalOptions="Center" Margin="20"/>
</Grid>
<VerticalStackLayout Spacing="10">
<Label Text="Présentation de l'application :" FontAttributes="Bold" FontSize="25" VerticalOptions="Start" TextColor="#72a3b3" HorizontalTextAlignment="Center"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<Label TextColor="#72a3b3" FontSize="17" HorizontalTextAlignment="Center" >
<Label.Text>
Ohara est le nom d'une île dans le manga One Piece, écrit par Eiichiro Oda. Cette île abritait de nombreux archéologues qui cherchaient à déceler les mystères du monde.Nous avons choisi le nom Ohara pour notre projet lié à la SAE 2.01, car notre application représente une véritable encyclopédie rassemblant des informations sur One Piece. Avec des centaines de personnages, des dizaines d'îles et de nombreux arcs d'histoire, il peut être difficile de se souvenir de tous les détails. Notre application a été conçue pour aider les fans à accéder facilement à toutes les informations sur One Piece,en offrant une expérience utilisateur fluide et intuitive.
</Label.Text>
</Label>
<Label TextColor="#72a3b3" FontAttributes="Bold" FontSize="17" HorizontalTextAlignment="Center" Text="Commencez dès maintenant à naviguer dans l'application grâce au menu à gauche ..." />
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>

@ -1,14 +1,15 @@
using Microsoft.Maui.Platform;
using Model.Managers;
using Plugin.Maui.Audio;
namespace Ohara;
public partial class MainPage : ContentPage
{
{
public Manager manager => (App.Current as App).manager;
public MainPage()
{
InitializeComponent();
BindingContext = manager;
}
}

@ -16,8 +16,8 @@ public static class MauiProgram
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("microns.ttf", "Icons");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("typicons.ttf", "Icons");
});
#if DEBUG

@ -49,6 +49,55 @@
<Button Text="Annuler" Style="{StaticResource buttonRetirerFavInfo}" Clicked="ButtonAnnuler_Clicked" />
</VerticalStackLayout >
<VerticalStackLayout Spacing="5" Margin="2">
<Frame Style="{StaticResource frameModif}" HeightRequest="175">
<HorizontalStackLayout HorizontalOptions="CenterAndExpand">
<CollectionView x:Name="listeCapitaine" SelectionChanged="AjoutCapitaine" SelectionMode="Single" HorizontalOptions="CenterAndExpand">
<CollectionView.Header>
<Label Text="Capitaine :"/>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Label Text="{Binding Nom}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</HorizontalStackLayout>
</Frame>
<Frame x:Name="framePicker" Style="{StaticResource frameModif}" HeightRequest="250">
<HorizontalStackLayout HorizontalOptions="Center">
<ScrollView Orientation="Vertical">
<CollectionView x:Name="listeAllie" ItemsSource="{Binding Equipages}" SelectionChanged="AjoutAllie" SelectionMode="Multiple">
<CollectionView.Header>
<Label Text="Allié(s) :"/>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Label Text="{Binding Nom}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
<ScrollView Orientation="Vertical">
<CollectionView x:Name="listeMembre" ItemsSource="{Binding Personnages}" SelectionChanged="AjoutMembre" SelectionMode="Multiple">
<CollectionView.Header>
<Label Text="Membre(s) :"/>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Label Text="{Binding Nom}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Statut :" FontAttributes="Bold"/>

@ -1,5 +1,6 @@
using Model.Classes;
using Model.Managers;
using System.Collections.Generic;
namespace Ohara;
@ -21,6 +22,8 @@ public partial class ModalEquipage : ContentPage
}
InitializeComponent();
BindingContext = nouvelEquipage;
framePicker.BindingContext = manager;
listeCapitaine.ItemsSource = manager.Personnages;
}
private async void ButtonConfirmer_Clicked(object sender, EventArgs e)
@ -54,4 +57,26 @@ public partial class ModalEquipage : ContentPage
nouvelEquipage.Image = stream;
}
}
private void AjoutAllie(object sender, SelectionChangedEventArgs e)
{
if (nouvelEquipage.Allie != null)
nouvelEquipage.ViderAllie();
foreach (var equipage in listeAllie.SelectedItems)
{
nouvelEquipage.AjouterAllie(equipage as Equipage);
}
}
private void AjoutMembre(object sender, SelectionChangedEventArgs e)
{
if (nouvelEquipage.Membre != null)
nouvelEquipage.ViderMembre();
foreach (var perso in listeMembre.SelectedItems)
{
nouvelEquipage.AjouterMembre(perso as Personnage);
}
}
private void AjoutCapitaine(object sender, SelectionChangedEventArgs e)
{
nouvelEquipage.Capitaine = listeCapitaine.SelectedItem as Personnage;
}
}

@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.ModalPersonnage"
Title="ModalPersonnage"
BackgroundColor="#e2edf1">
BackgroundColor="#e2edf1"
Shell.PresentationMode="ModalAnimated">
<ScrollView>
<FlexLayout AlignItems="End" Wrap="Wrap" Direction="Row" JustifyContent="Center" HorizontalOptions="Center" VerticalOptions="Center" >
<VerticalStackLayout Spacing="4" Margin="2">
@ -21,12 +22,7 @@
</Frame>
<Button Text="Choisir une image ..." Clicked="ButtonImage_Clicked" Grid.Row="2" VerticalOptions="End" />
</Grid>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Nom Romanise :" FontAttributes="Bold"/>
<Entry Text="{Binding NomRomanise}" />
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Prime :" FontAttributes="Bold"/>
@ -39,26 +35,64 @@
<Entry Text="{Binding Epithete}" />
</HorizontalStackLayout>
</Frame>
<Button Text="Annuler" Style="{StaticResource buttonRetirerFavInfo}" Clicked="ButtonAnnuler_Clicked" />
</VerticalStackLayout >
<VerticalStackLayout Spacing="5" Margin="2">
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Taille :" FontAttributes="Bold"/>
<Entry Text="{Binding Taille}" />
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Origine :" FontAttributes="Bold"/>
<Entry Text="{Binding Origine}" />
</HorizontalStackLayout >
</Frame>
<Button Text="Annuler" Style="{StaticResource buttonRetirerFavInfo}" Clicked="ButtonAnnuler_Clicked" />
</VerticalStackLayout >
<VerticalStackLayout Spacing="5" Margin="2">
<Frame x:Name="framePicker" Style="{StaticResource frameModif}" HeightRequest="300">
<HorizontalStackLayout HorizontalOptions="Center">
<ScrollView Orientation="Vertical">
<CollectionView x:Name="listeEquipages" ItemsSource="{Binding Equipages}" SelectionChanged="AjoutEquipage" SelectionMode="Single">
<CollectionView.Header>
<Label Text="Equipage :"/>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Label Text="{Binding Nom}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
<ScrollView Orientation="Vertical">
<CollectionView x:Name="listeFruits" ItemsSource="{Binding Fruits}" SelectionChanged="AjoutFruit" SelectionMode="Multiple">
<CollectionView.Header>
<Label Text="Fruit(s) du démon :"/>
</CollectionView.Header>
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Label Text="{Binding Nom}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Description :" FontAttributes="Bold"/>
<Editor Text="{Binding Description}" WidthRequest="300" HeightRequest="200"/>
<Label Text="Biographie :" FontAttributes="Bold"/>
<Editor Text="{Binding Biographie}" WidthRequest="300" HeightRequest="200"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameModif}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Geographie :" FontAttributes="Bold"/>
<Editor Text="{Binding Geographie}" WidthRequest="300" HeightRequest="150"/>
<Label Text="Citation :" FontAttributes="Bold"/>
<Editor Text="{Binding Citation}" WidthRequest="300" HeightRequest="150"/>
</HorizontalStackLayout>
</Frame>
<Button Text="Confirmer" Style="{StaticResource buttonFavsInfo}" Clicked="ButtonConfirmer_Clicked" />

@ -6,15 +6,37 @@ namespace Ohara;
public partial class ModalPersonnage : ContentPage
{
public Manager manager => (App.Current as App).manager;
public Personnage nouveauPerso = new Personnage("Personnage", 0, "", 0, 0, "", "", "");
public ModalPersonnage()
{
InitializeComponent();
public Personnage nouveauPerso;
public string ancienNom;
public ModalPersonnage()
{
if (manager.SelectedItem != null)
{
nouveauPerso = manager.SelectedItem as Personnage;
ancienNom = nouveauPerso.Nom;
}
else
{
nouveauPerso = new Personnage("Personnage",0, " ", 0, 0, " ", " ", "");
}
InitializeComponent();
BindingContext = nouveauPerso;
}
framePicker.BindingContext = manager;
}
private async void ButtonConfirmer_Clicked(object sender, EventArgs e)
{
manager.AjouterPerso(nouveauPerso);
if (manager.SelectedItem != null)
{
manager.ModifierPerso(nouveauPerso, ancienNom);
nouveauPerso = manager.SelectedItem as Personnage;
}
else
{
manager.AjouterPerso(nouveauPerso);
}
await Navigation.PopModalAsync();
}
private async void ButtonAnnuler_Clicked(object sender, EventArgs e)
@ -35,4 +57,18 @@ public partial class ModalPersonnage : ContentPage
nouveauPerso.Image = stream;
}
}
private void AjoutEquipage(object sender, SelectionChangedEventArgs e)
{
nouveauPerso.Equipage = listeEquipages.SelectedItem as Equipage;
}
private void AjoutFruit(object sender, SelectionChangedEventArgs e)
{
if (nouveauPerso.Fruit != null)
nouveauPerso.ViderFruit();
foreach(var fruit in listeFruits.SelectedItems)
{
nouveauPerso.AjouterFruit(fruit as FruitDuDemon);
}
}
}

@ -92,9 +92,6 @@
<Compile Update="PageBestiaire.xaml.cs">
<DependentUpon>PageBestiaire.xaml</DependentUpon>
</Compile>
<Compile Update="PageCarte.xaml.cs">
<DependentUpon>PageCarte.xaml</DependentUpon>
</Compile>
<Compile Update="PageBateau.xaml.cs">
<DependentUpon>PageBateau.xaml</DependentUpon>
</Compile>
@ -140,9 +137,6 @@
<MauiXaml Update="PageIle.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="PageCarte.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="PageInfoIle.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -8,20 +8,10 @@
<VerticalStackLayout Spacing="40">
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10">
<Grid ColumnDefinitions="200,*,100,10,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/>
<Picker Title="Filtrer" Grid.Column="4" ItemsSource="{Binding Equipages}" ItemDisplayBinding="{Binding Nom}" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}"/>
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="4"/>
<Picker Title="Filtrer" Grid.Column="2" ItemsSource="{Binding Equipages}" ItemDisplayBinding="{Binding Nom}" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}"/>
</Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listeBateau" ItemsSource="{Binding Bateaux}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBateau_SelectionChanged" >

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

@ -8,28 +8,9 @@
<ScrollView>
<VerticalStackLayout>
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10">
<Grid ColumnDefinitions="200,*,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="ButtonAjouter_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/>
<!--<Picker Title="Filtrer" Grid.Column="4" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}" >
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Aucun</x:String>
<x:String>Logia</x:String>
<x:String>Paramecia</x:String>
<x:String>Zoan Carnivore</x:String>
<x:String>Zoan Mythique</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>-->
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</Grid>
<FlexLayout x:Name="listeBest" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center"

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

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.PageCarte"
BackgroundColor="#e2edf1">
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Spacing="40">
<Image Source="carte.png" HorizontalOptions="Center" />
</VerticalStackLayout>
<!--<Rectangle WidthRequest="200" HeightRequest="300" HorizontalOptions="Start" BackgroundColor="#72a3b3">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="#cdffd8" Offset="0.0" />-->
<!--<GradientStop Color="#94b9ff" Offset="1.0" /></LinearGradientBrush></Rectangle.Fill></Rectangle>-->
</ContentPage>

@ -1,13 +0,0 @@
using Plugin.Maui.Audio;
namespace Ohara;
public partial class PageCarte : ContentPage
{
public PageCarte()
{
InitializeComponent();
}
}

@ -7,18 +7,9 @@
BackgroundColor="#e2edf1">
<ScrollView>
<VerticalStackLayout>
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10">
<Grid ColumnDefinitions="200,*,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="ButtonAjouter_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/>
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</Grid>
<FlexLayout x:Name="listEquip" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center" JustifyContent="SpaceEvenly">

@ -7,10 +7,10 @@
BackgroundColor="#e2edf1">
<ScrollView>
<VerticalStackLayout>
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10">
<Grid ColumnDefinitions="200,*,100,10,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/>
<Picker Title="Filtrer" Grid.Column="4" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}" >
<Picker Title="Filtrer" Grid.Column="2" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}" >
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Aucun</x:String>
@ -21,14 +21,7 @@
</x:Array>
</Picker.ItemsSource>
</Picker>
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="4"/>
</Grid>
<FlexLayout x:Name="listeFDD" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center"

@ -8,28 +8,9 @@
<ScrollView>
<VerticalStackLayout>
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<!--<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/>
<Picker Title="Filtrer" Grid.Column="4" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}" >
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Aucun</x:String>
<x:String>Logia</x:String>
<x:String>Paramecia</x:String>
<x:String>Zoan Carnivore</x:String>
<x:String>Zoan Mythique</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>-->
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
<Grid ColumnDefinitions="*" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" HorizontalOptions="Center" WidthRequest="300"/>
</Grid>
<FlexLayout x:Name="listeFav" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center" JustifyContent="SpaceEvenly">

@ -5,14 +5,11 @@
Title="PageIle"
Appearing="ContentPage_Appearing"
BackgroundColor="#e2edf1">
<VerticalStackLayout Spacing="40">
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10">
<Grid ColumnDefinitions="200,*,100,10,150" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/>
<Picker Title="Filtrer" Grid.Column="4" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}" >
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="4"/>
<Picker Title="Filtrer" Grid.Column="2" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}" >
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Aucun</x:String>
@ -24,21 +21,11 @@
</x:Array>
</Picker.ItemsSource>
</Picker>
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Nom croissant</x:String>
<x:String>Nom décroissant</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listeIle" ItemsSource="{Binding Iles}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeIle_SelectionChanged" >
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="50" ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400"/>
@ -46,8 +33,6 @@
<Grid.RowDefinitions>
<RowDefinition Height="750"/>
</Grid.RowDefinitions>
<Frame
CornerRadius="25"
BorderColor="#e2edf1"
@ -61,9 +46,6 @@
Aspect="Fill"
/>
</Frame>
<Frame Style="{StaticResource frameObjet2}">

@ -19,10 +19,7 @@ public partial class PageInfoBateau : ContentPage
retirerFav.IsVisible = true;
}
if(((Bateau)manager.SelectedItem).Affiliation==null)
bouttonAffiliation.IsVisible=false;
BindingContext =manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)

@ -68,25 +68,25 @@
</StackLayout>
</Frame>
</VerticalStackLayout>
</Grid>
<Label Text="Description :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<Label Text="{Binding Description}" TextColor="#72a3b3" />
<Label Text="Membre(s) :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<CollectionView x:Name="listMembre" ItemsLayout="HorizontalList" ItemsSource="{Binding Membre}" SelectionMode="Single" SelectionChanged="listMembre_SelectionChanged" >
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="75*,25*" ColumnSpacing="10">
<VerticalStackLayout Spacing="5">
<Label Text="Membre(s) :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<ScrollView Orientation="Horizontal">
<CollectionView x:Name="listMembre" ItemsLayout="HorizontalList" ItemsSource="{Binding Membre}" EmptyView="Cet équipage n'à pas de membres..." SelectionMode="Single" SelectionChanged="listMembre_SelectionChanged" >
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameObjet}" Margin="5">
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
<Frame Style="{StaticResource frameObjet}" Margin="5">
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
HeightRequest="175"
WidthRequest="175"/>
<Label
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
@ -95,40 +95,66 @@
FontSize="15"
TextColor="#72a3b3"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="Allié(s) :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<CollectionView x:Name="listAlle" ItemsLayout="HorizontalList" ItemsSource="{Binding Allie}" SelectionMode="Single" SelectionChanged="listAlle_SelectionChanged" >
<CollectionView.ItemTemplate>
<DataTemplate>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Spacing="5">
<Label Text="Capitaine :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<Frame Style="{StaticResource frameEquip}" >
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
<Frame BindingContext="{Binding Capitaine}" Style="{StaticResource frameObjet}" HorizontalOptions="Center" Margin="5">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
HeightRequest="175"
WidthRequest="175"/>
<Label
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="15"
TextColor="White"
TextColor="#72a3b3"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</VerticalStackLayout>
</Grid>
<Label Text="Allié(s) :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<CollectionView x:Name="listAlle" ItemsLayout="HorizontalList" ItemsSource="{Binding Allie}" EmptyView="Cet équipage n'à pas d'alliés..." SelectionMode="Single" SelectionChanged="listAlle_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameEquip}" Margin="5">
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
HeightRequest="175"
WidthRequest="175"/>
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="15"
TextColor="White"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</ContentPage>

@ -16,10 +16,8 @@ public partial class PageInfoEquipage : ContentPage
bouttonFav.IsEnabled = false;
bouttonFav.Text = "Ajouté au favoris";
retirerFav.IsVisible = true;
}
}
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
@ -37,8 +35,6 @@ public partial class PageInfoEquipage : ContentPage
bouttonFav.Text = "Ajouter au favoris";
retirerFav.IsVisible = false;
}
private async void listMembre_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.CurrentSelection.Count == 0) return;
@ -52,7 +48,7 @@ public partial class PageInfoEquipage : ContentPage
manager.SelectedItem = (Equipage)listAlle.SelectedItem;
await Navigation.PushAsync(new PageInfoEquipage());
}
private async void Supprimer_Clicked(object sender, EventArgs e)
{
manager.SupprimerEquip((Equipage)manager.SelectedItem);
@ -60,12 +56,18 @@ public partial class PageInfoEquipage : ContentPage
}
private void ContentPage_Appearing(object sender, EventArgs e)
{
listAlle.SelectedItem=null;
listMembre.SelectedItem=null;
}
private async void Modifier_Clicked(object sender, EventArgs e)
{
await Shell.Current.GoToAsync(nameof(ModalEquipage), true);
}
private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
{
manager.SelectedItem = manager.SelectedItem as Personnage;
await Shell.Current.GoToAsync(nameof(PageInfoPersonnage));
}
}

@ -22,10 +22,7 @@
<Label Text="2 - Citation" TextColor="#72a3b3"/>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<Label Text="3 - Equipage(s)" TextColor="#72a3b3"/>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<Label Text="4 - Fruit(s)" TextColor="#72a3b3"/>
<Label Text="3 - Fruit(s)" TextColor="#72a3b3"/>
</Frame>
<FlexLayout AlignItems="Start" Wrap="NoWrap" Direction="Row" JustifyContent="SpaceEvenly" HorizontalOptions="Start">
<Button Text="Supprimer" Style="{StaticResource buttonRetirerFavInfo}" Clicked="Supprimer_Clicked" FlexLayout.Basis="49.5%"/>
@ -43,7 +40,6 @@
IsClippedToBounds="True"
Padding="0"
HeightRequest="400"
>
<Image
Source="{Binding Image}"
@ -51,7 +47,9 @@
/>
</Frame>
<VerticalStackLayout Spacing="4">
<Button x:Name="bouttonAffiliation" Text="{Binding Equipage.Nom, StringFormat='Equipage : {0}'}" Style="{StaticResource buttonFavsInfo}" Clicked="ButtonAffiliation_Clicked" ToolTipProperties.Text="Clickez pour en savoir plus..." FontSize="15"/>
<Frame Style="{StaticResource frameInfo}">
<StackLayout HorizontalOptions="Center" Orientation="Horizontal" Spacing="5">
<Label Text="Prime :" TextColor="#72a3b3" FontAttributes="Bold"/>
@ -95,35 +93,12 @@
<Label Text="Citation(s) :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<Label Text="{Binding Citation}" Style="{StaticResource citationPerso}" />
<Label Text="Equipage(s) :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<CollectionView x:Name="listEquip" ItemsLayout="HorizontalList" ItemsSource="{Binding Equipage}" SelectionMode="Single" SelectionChanged="listEquip_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameEquip}" Margin="5">
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
HeightRequest="175"
WidthRequest="175"/>
<Label
HorizontalOptions="Center"
VerticalOptions="Start"
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="15"
TextColor="white"
FontAttributes="Bold" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="Fruit :" TextColor="#72a3b3" FontSize="20" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<CollectionView x:Name="listFruit" ItemsLayout="HorizontalList" ItemsSource="{Binding Fruit}" SelectionMode="Single" SelectionChanged="listFruit_SelectionChanged">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Style="{StaticResource frameEquip}" Margin="5">
<Frame Style="{StaticResource frameObjet}" Margin="5">
<StackLayout Orientation="Vertical">
<Image Source="{Binding Image}"
HeightRequest="175"
@ -134,7 +109,7 @@
HorizontalTextAlignment="Center"
Text="{Binding Nom}"
FontSize="15"
TextColor="white"
TextColor="#72a3b3"
FontAttributes="Bold" />
</StackLayout>
</Frame>

@ -17,8 +17,11 @@ public partial class PageInfoPersonnage : ContentPage
retirerFav.IsVisible = true;
}
if (((Personnage)manager.SelectedItem).Equipage == null)
bouttonAffiliation.IsVisible = false;
BindingContext = manager.SelectedItem;
}
private void AjouterFav_Clicked(object sender, EventArgs e)
@ -37,14 +40,6 @@ public partial class PageInfoPersonnage : ContentPage
retirerFav.IsVisible = false;
}
private async void listEquip_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.CurrentSelection.Count == 0) return;
manager.SelectedItem = (Equipage)listEquip.SelectedItem;
await Navigation.PushAsync(new PageInfoEquipage());
}
private async void listFruit_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
@ -54,9 +49,7 @@ public partial class PageInfoPersonnage : ContentPage
}
private void ContentPage_Appearing(object sender, EventArgs e)
{
listEquip.SelectedItem = null;
{
listFruit.SelectedItem = null;
}
private async void Supprimer_Clicked(object sender, EventArgs e)
@ -69,4 +62,12 @@ public partial class PageInfoPersonnage : ContentPage
{
await Shell.Current.GoToAsync(nameof(ModalPersonnage), true);
}
private async void ButtonAffiliation_Clicked(object sender, EventArgs e)
{
manager.SelectedItem = (manager.SelectedItem as Personnage).Equipage;
await Navigation.PushAsync(new PageInfoEquipage());
}
}

@ -8,12 +8,14 @@ namespace Ohara.Resources
{
static class IconFont
{
public const string Perso = "\ue738";
public const string Fav = "\ue72c";
public const string Equip = "\ue72e";
public const string Icon4 = "\ue75b";
public const string Suppr = "\ue732";
public const string Add = "\ue70d";
public const string Modif = "\ue736";
public const string Fdd = "\ue104";
public const string Equip = "\ue074";
public const string Bateau = "\ue003";
public const string Acceuil = "\ue08a";
public const string Best = "\ue083";
public const string Perso = "\ue12c";
public const string Ile = "\ue081";
public const string Fav = "\ue109";
}
}

@ -41,14 +41,14 @@ Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux)
{
manager.ModifierFavoris(b, false);
manager.ModifierFavBateau(b, false);
}
//Tests serialization :
XML_Serializer serializer = new XML_Serializer();
//Affichage d'un objet à son état initiale
Console.WriteLine(manager.Bateaux[0]);
//Modification de cet objet
manager.ModifierFavoris(manager.Bateaux[0], true);
manager.ModifierFavBateau(manager.Bateaux[0], true);
Console.WriteLine(manager.Bateaux[0]);
//Serialization de la liste contenant l'objet
serializer.SetBateau(manager.Bateaux.ToList());
@ -65,17 +65,17 @@ Console.WriteLine("\n");
foreach (Bateau b in manager.Bateaux)
{
manager.ModifierFavoris(b, false);
manager.ModifierFavBateau(b, false);
}
//Ajout d'un objet en favoris
manager.ModifierFavoris(manager.Bateaux[0],true);
manager.ModifierFavBateau(manager.Bateaux[0],true);
foreach (ObjetOhara o in manager.GetFavoris())
{
Console.WriteLine(o.Nom);
}
//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())
{
Console.WriteLine(o.Nom);
@ -92,8 +92,8 @@ foreach (FruitDuDemon f in manager.FiltrerFDD("Logia"))
Console.WriteLine("\n");
Console.WriteLine("\n");
// 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);
}
@ -101,7 +101,7 @@ Console.WriteLine("\n");
Console.WriteLine("\n");
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,96 @@
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);
}
[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);
}
}
}

@ -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 Newtonsoft.Json.Bson;
using NuGet.Frameworks;
using System;
using System.Collections.Generic;
using System.Linq;
@ -23,5 +25,21 @@ namespace TestProject1
bool resultat = (test.Image == "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,26 @@ namespace TestProject1
bool resultat = (test.Image == "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 ...", "");
Personnage personnage1 = new Personnage("Perso", 0, "", 0, 0, "", "", "");
Bestiaire bestiaire3 = new Bestiaire("adad", "??", "Les humains sont ...", "Ils possèdent les caractéristiques suivantes ...", "");
bool resultat = (bestiaire1.Equals(bestiaire2));
bool resultat2 = (bestiaire1.Equals(personnage1));
bool resultat3 = (bestiaire1.Equals(bestiaire3));
Assert.True(resultat, "Les deux bestiaires devraient etre égaux car ils onts le meme nom");
Assert.False(resultat2);
Assert.False(resultat3);
}
}
}

@ -23,5 +23,21 @@ namespace TestProject1
bool resultat = (test.Image == "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]
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.");
bool resultat = (test.PremierChap >= 0 && test.PremierEp >= 0);
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, "Les paramètre PremierChap et PremierEp doivent être supérieur ou égale à 0");
}
[Fact]
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");
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");
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");
}
}
}

@ -0,0 +1,350 @@
using Model.Classes;
using Model.Managers;
using Model.Serializer;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class TestManager
{
public Manager manager = new Manager(new StubManager());
[Fact]
public void Constructor_InitializesCollections()
{
Assert.NotNull(manager.Bateaux);
Assert.NotNull(manager.Personnages);
Assert.NotNull(manager.Fruits);
Assert.NotNull(manager.Iles);
Assert.NotNull(manager.Bestiaire);
Assert.NotNull(manager.Equipages);
}
[Fact]
public void FiltrerFDD_ReturnsFilteredFruits()
{
// Arrange
var type = "Paramecia";
var fruits = new List<FruitDuDemon>
{
new FruitDuDemon("fruit1", "", "Paramecia", 0, 0,"","",""),
new FruitDuDemon("fruit2", "", "Logia", 0, 0,"","",""),
new FruitDuDemon("fruit3", "", "Zoan", 0, 0,"","",""),
};
manager.Fruits = new ObservableCollection<FruitDuDemon>(fruits);
// Act
var result = manager.FiltrerFDD(type);
// Assert
Assert.True(1== result.Count);
Assert.True("Paramecia"== result[0].Type);
}
[Fact]
public void FiltrerBateau_ReturnsMatchingBateaux()
{
var bateau1 = new Bateau("bateau1", "", 0, 0, "", "");
var bateau2 = new Bateau("bateau1", "", 0, 0, "", "");
var bateau3 = new Bateau("bateau", "", 0, 0, "", "");
bateau1.Affiliation = new Equipage("Mugiwara", "","",0,0,true,"");
bateau2.Affiliation = new Equipage("Barbe noire", "", "", 0, 0, true, "");
bateau3.Affiliation = new Equipage("Barbe blanche", "", "", 0, 0, true, "");
var bateaux = new List<Bateau> { bateau1,bateau2 ,bateau3};
manager.Bateaux = new ObservableCollection<Bateau>(bateaux);
var result = manager.FiltrerBateau("Mugiwara");
Assert.True(1 == result.Count);
Assert.True("Mugiwara" == result[0].Affiliation.Nom);
}
[Fact]
public void FiltrerIle_ReturnsMatchingIles()
{
var iles = new List<Ile> {
new Ile("ile1","","East Blue",0,0,"",""),
new Ile("ile2","","Grand Line",0,0,"",""),
new Ile("ile3","","West Blue",0,0,"",""),
};
manager.Iles = new ObservableCollection<Ile>(iles);
var result = manager.FiltrerIle("East Blue");
Assert.True(1 == result.Count);
Assert.True("East Blue" == result[0].Region);
}
[Fact]
public void RechercheObjetOhara_ReturnsFilteredList()
{
// Arrange
var text = "abc";
var obj1 = new ObjetOhara("abcd");
var obj2 = new ObjetOhara("bcde");
var obj3 = new ObjetOhara("defg");
var liste = new List<ObjetOhara> { obj1, obj2, obj3 };
// Act
var result = manager.RechercheObjetOhara(text, liste);
// Assert
Assert.True(1==result.Count);
Assert.Contains(obj1, result);
Assert.True(!result.Contains(obj3));
}
[Fact]
public void GetFavoris_ReturnsFavoritedObjects()
{
var obj1 =manager.Fruits.First();
var obj2 = manager.Equipages.First();
manager.ModifierFavFDD(obj1, true);
var result = manager.GetFavoris();
Assert.True(1==result.Count);
Assert.Contains(obj1, result);
Assert.True(!result.Contains(obj2));
}
[Fact]
public void ModifierFavFDD_UpdatesFruitDuDemonFavori()
{
var fruit = new FruitDuDemon("Fruit", "", "", 0, 0, "", "","");
manager.Fruits.Add(fruit);
manager.ModifierFavFDD(fruit, true);
fruit = manager.Fruits.FirstOrDefault(p => fruit.Nom == p.Nom);
Assert.NotNull(fruit);
Assert.True(fruit.EstFavori);
}
[Fact]
public void ModifierFavEquip_UpdatesEquipageFavori()
{
var equip = new Equipage("Equipage","","",0,0,true,"");
manager.Equipages.Add(equip);
manager.ModifierFavEquip(equip, true);
equip = manager.Equipages.FirstOrDefault(p=> equip.Nom == p.Nom);
Assert.NotNull(equip);
Assert.True(equip.EstFavori);
}
[Fact]
public void ModifierFavBest_UpdatesBestiaireFavori()
{
var best = new Bestiaire("Bestiaire", "", "","");
manager.Bestiaire.Add(best);
manager.ModifierFavBest(best, true);
best = manager.Bestiaire.FirstOrDefault(p => best.Nom == p.Nom);
Assert.NotNull(best);
Assert.True(best.EstFavori);
}
[Fact]
public void ModifierFavPerso_UpdatesPersonnageFavori()
{
var perso = new Personnage("Personnage", 0, "", 0, 0, "", "", "");
manager.Personnages.Add(perso);
manager.ModifierFavPerso(perso, true);
perso = manager.Personnages.FirstOrDefault(p => perso.Nom == p.Nom);
Assert.NotNull(perso);
Assert.True(perso.EstFavori);
}
[Fact]
public void ModifierFavIle_UpdatesIleFavori()
{
var ile = new Ile("Ile", "", "", 0, 0, "", "");
manager.Iles.Add(ile);
manager.ModifierFavIle(ile, true);
ile = manager.Iles.FirstOrDefault(p => ile.Nom == p.Nom);
Assert.NotNull(ile);
Assert.True(ile.EstFavori);
}
[Fact]
public void ModifierFavBateau_UpdatesBateauFavori()
{
var bateau = new Bateau("Bateau", "", 0, 0, "", "");
manager.Bateaux.Add(bateau);
manager.ModifierFavBateau(bateau, true);
bateau = manager.Bateaux.FirstOrDefault(p => bateau.Nom == p.Nom);
Assert.NotNull(bateau);
Assert.True(bateau.EstFavori);
}
[Fact]
public void ModifierIle_Should_UpdateIle_When_ExistingAncienNom()
{
Ile ancienneIle = new Ile("AncienNom","","",0,0,"","");
Ile nouvelleIle = new Ile("NouveauNom", "", "", 0, 0, "", "");
manager.Iles.Add(ancienneIle);
manager.ModifierIle(nouvelleIle, "AncienNom");
Assert.DoesNotContain(ancienneIle,manager.Iles);
Assert.Contains(nouvelleIle,manager.Iles); ;
}
[Fact]
public void ModifierIle_Should_NotUpdateIle_When_NonExistingAncienNom()
{
Ile ancienneIle = new Ile("AncienNom", "", "", 0, 0, "", "");
Ile nouvelleIle = new Ile("NouveauNom", "", "", 0, 0, "", "");
manager.Iles.Add(ancienneIle);
manager.ModifierIle(nouvelleIle, "iadjadiozadioazj");
Assert.Contains(ancienneIle, manager.Iles);
Assert.DoesNotContain(nouvelleIle, manager.Iles);
}
[Fact]
public void ModifierFDD_Should_UpdateIle_When_ExistingAncienNom()
{
FruitDuDemon ancienneFDD = new FruitDuDemon("AncienNom", "", "",0, 0, "", "","");
FruitDuDemon nouvelleFDD = new FruitDuDemon("NouveauNom", "", "", 0, 0, "", "","");
manager.Fruits.Add(ancienneFDD);
manager.ModifierFDD(nouvelleFDD, "AncienNom");
Assert.DoesNotContain(ancienneFDD, manager.Fruits);
Assert.Contains(nouvelleFDD, manager.Fruits); ;
}
[Fact]
public void ModifierFDD_Should_NotUpdateIle_When_NonExistingAncienNom()
{
FruitDuDemon ancienneFDD = new FruitDuDemon("AncienNom", "", "", 0, 0, "", "", "");
FruitDuDemon nouvelleFDD = new FruitDuDemon("NouveauNom", "", "", 0, 0, "", "", "");
manager.Fruits.Add(ancienneFDD);
manager.ModifierFDD(nouvelleFDD, "ADADADAZDAZD");
Assert.Contains(ancienneFDD, manager.Fruits);
Assert.DoesNotContain(nouvelleFDD, manager.Fruits);
}
[Fact]
public void ModifierPerso_Should_UpdateIle_When_ExistingAncienNom()
{
Personnage ancienPerso = new Personnage("AncienNom",0,"",0,0, "", "", "");
Personnage nouveauPerso = new Personnage("NouveauNom", 0, "", 0,0, "", "", "");
manager.Personnages.Add(ancienPerso);
manager.ModifierPerso(nouveauPerso, "AncienNom");
Assert.DoesNotContain(ancienPerso, manager.Personnages);
Assert.Contains(nouveauPerso, manager.Personnages);
}
[Fact]
public void ModifierPerso_Should_NotUpdateIle_When_NonExistingAncienNom()
{
Personnage ancienPerso = new Personnage("AncienNom", 0, "", 0, 0, "", "", "");
Personnage nouveauPerso = new Personnage("NouveauNom", 0, "", 0, 0, "", "", "");
manager.Personnages.Add(ancienPerso);
manager.ModifierPerso(nouveauPerso, "adadadadzdd");
Assert.Contains(ancienPerso, manager.Personnages);
Assert.DoesNotContain(nouveauPerso, manager.Personnages);
}
[Fact]
public void ModifierBest_Should_UpdateIle_When_ExistingAncienNom()
{
Bestiaire ancienBest = new Bestiaire("AncienNom", "", "", "", "");
Bestiaire nouveauBest = new Bestiaire("NouveauNom", "", "", "", "");
manager.Bestiaire.Add(ancienBest);
manager.ModifierBest(nouveauBest, "AncienNom");
Assert.DoesNotContain(ancienBest, manager.Bestiaire);
Assert.Contains(nouveauBest, manager.Bestiaire);
}
[Fact]
public void ModifierBest_Should_NotUpdateIle_When_NonExistingAncienNom()
{
Bestiaire ancienBest = new Bestiaire("AncienNom", "", "", "", "");
Bestiaire nouveauBest = new Bestiaire("NouveauNom", "", "", "", "");
manager.Bestiaire.Add(ancienBest);
manager.ModifierBest(nouveauBest, "adadadadzdd");
Assert.Contains(ancienBest, manager.Bestiaire);
Assert.DoesNotContain(nouveauBest, manager.Bestiaire);
}
[Fact]
public void ModifierEquip_Should_UpdateIle_When_ExistingAncienNom()
{
Equipage ancienEquîp = new Equipage("AncienNom", "", "",0,0 ,true, "");
Equipage nouveauEquip = new Equipage("NouveauNom", "", "", 0, 0, true, "");
manager.Equipages.Add(ancienEquîp);
manager.ModifierEquipage(nouveauEquip, "AncienNom");
Assert.DoesNotContain(ancienEquîp, manager.Equipages);
Assert.Contains(nouveauEquip, manager.Equipages);
}
[Fact]
public void ModifierEquipage_Should_NotUpdateIle_When_NonExistingAncienNom()
{
Equipage ancienEquîp = new Equipage("AncienNom", "", "", 0, 0, true, "");
Equipage nouveauEquip = new Equipage("NouveauNom", "", "", 0, 0, true, "");
manager.Equipages.Add(ancienEquîp);
manager.ModifierEquipage(nouveauEquip, "adadadda");
Assert.Contains(ancienEquîp, manager.Equipages);
Assert.DoesNotContain(nouveauEquip, manager.Equipages);
}
[Fact]
public void ModifierBateau_Should_UpdateIle_When_ExistingAncienNom()
{
Bateau ancienBateau = new Bateau("AncienNom", "", 0, 0, "", "");
Bateau nouveauBateau = new Bateau("NouveauNom", "", 0, 0, "", "");
manager.Bateaux.Add(ancienBateau);
manager.ModifierBateau(nouveauBateau, "AncienNom");
Assert.DoesNotContain(ancienBateau, manager.Bateaux);
Assert.Contains(nouveauBateau, manager.Bateaux);
}
[Fact]
public void ModifierBateau_Should_NotUpdateIle_When_NonExistingAncienNom()
{
Bateau ancienBateau = new Bateau("AncienNom", "", 0, 0, "", "");
Bateau nouveauBateau = new Bateau("NouveauNom", "", 0, 0, "", "");
manager.Bateaux.Add(ancienBateau);
manager.ModifierBateau(nouveauBateau, "adfadadzdaz");
Assert.Contains(ancienBateau, manager.Bateaux);
Assert.DoesNotContain(nouveauBateau, manager.Bateaux);
}
}
}

@ -0,0 +1,48 @@
using Model.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class TestObjetOhara
{
[Fact]
public void ToString_ReturnsCorrectStringRepresentation()
{
var obj = new ObjetOhara("Objet 1", "image.png", true);
var result = obj.ToString();
Assert.True("ObjetOhara : Objet 1 True image.png"== result);
}
[Fact]
public void Equals_SameObject_ReturnsTrue()
{
var obj = new ObjetOhara("Objet 1");
var obj2 = new ObjetOhara("Objet 2");
var obj3 = new Bateau("Objet 3", "", 0, 0, "","");
var result = obj.Equals(obj);
var result2 = obj.Equals(obj2);
var result3 = obj.Equals(obj3);
Assert.True(result);
Assert.False(result2);
Assert.False(result3);
}
[Fact]
public void GetHashCode_ObjectsWithSameProperties_ReturnsSameHashCode()
{
var obj1 = new ObjetOhara("Objet 1", "image.png", true);
var obj2 = new ObjetOhara("Objet 1", "image.png", true);
var hashCode1 = obj1.GetHashCode();
var hashCode2 = obj2.GetHashCode();
Assert.True(hashCode1==hashCode2);
}
}
}

@ -16,6 +16,14 @@ namespace TestProject1
bool resultat = (test.Image == "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]
public void Personnage_PrimeSuperieurOuEgalAZero_ReturnTrue()
{
@ -30,5 +38,13 @@ namespace TestProject1
bool resultat = (test.Taille >= 0);
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");
}
}
}

@ -0,0 +1,348 @@
using Model.Classes;
using Model.Serializer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace TestProject1
{
public class XMLSerializerTests
{
public XML_Serializer serializer = new XML_Serializer();
[Fact]
public void SetPersonnage_SerializesAndWritesToFile()
{
var obj1 = new Personnage("Personnage 1", 0, "", 0, 0, "", "", "");
var obj2 = new Personnage("Personnage 2", 0, "", 0, 0, "", "", "");
var listePerso = new List<Personnage>
{
obj1,
obj2,
};
serializer.SetPersonnage(listePerso);
string xmlFilePath = Path.Combine(serializer.Chemin, "personnage.xml");
Assert.True(File.Exists(xmlFilePath));
using (Stream stream = File.OpenRead(xmlFilePath))
{
var deserializer = new DataContractSerializer(typeof(List<Personnage>));
var result = deserializer.ReadObject(stream) as List<Personnage>;
Assert.NotNull(result);
Assert.Contains(obj1,result);
Assert.Contains(obj2,result);
}
}
[Fact]
public void GetPersonnages_ReadsFromFileAndDeserializes()
{
var obj1 = new Personnage("Personnage 1", 0, "", 0, 0, "", "", "");
var obj2 = new Personnage("Personnage 2", 0, "", 0, 0, "", "", "");
var listePerso = new List<Personnage>
{
obj1,
obj2,
};
string xmlFilePath = Path.Combine(serializer.Chemin, "personnage.xml");
using (Stream stream = File.Create(xmlFilePath))
{
var xmlSerializer = new DataContractSerializer(typeof(List<Personnage>));
xmlSerializer.WriteObject(stream, listePerso);
}
var result = serializer.GetPersonnages();
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
[Fact]
public void SetEquipages_SerializesAndWritesToFile()
{
var obj1 = new Equipage("Equipage 1", "","", 0, 0,true, "");
var obj2 = new Equipage("Equipage 2", "", "", 0, 0, true, "");
var listeEquip = new List<Equipage>
{
obj1,
obj2,
};
serializer.SetEquipage(listeEquip);
string xmlFilePath = Path.Combine(serializer.Chemin, "equipage.xml");
Assert.True(File.Exists(xmlFilePath));
using (Stream stream = File.OpenRead(xmlFilePath))
{
var deserializer = new DataContractSerializer(typeof(List<Equipage>));
var result = deserializer.ReadObject(stream) as List<Equipage>;
Assert.NotNull(result);
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
}
[Fact]
public void GetEquipages_ReadsFromFileAndDeserializes()
{
var obj1 = new Equipage("Equipage 1", "", "", 0, 0, true, "");
var obj2 = new Equipage("Equipage 2", "", "", 0, 0, true, "");
var listeEquip = new List<Equipage>
{
obj1,
obj2,
};
string xmlFilePath = Path.Combine(serializer.Chemin, "equipage.xml");
using (Stream stream = File.Create(xmlFilePath))
{
var xmlSerializer = new DataContractSerializer(typeof(List<Equipage>));
xmlSerializer.WriteObject(stream, listeEquip);
}
// Act
var result = serializer.GetEquipages();
// Assert
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
[Fact]
public void SetFDD_SerializesAndWritesToFile()
{
/// Arrange
var obj1 = new FruitDuDemon("Fruit 1", "","", 0, 0, "", "", "");
var obj2 = new FruitDuDemon("Fruit 2", "", "", 0, 0, "", "", "");
var listFDD = new List<FruitDuDemon>
{
obj1,
obj2,
};
// Act
serializer.SetFDD(listFDD);
// Assert
string xmlFilePath = Path.Combine(serializer.Chemin, "fruitdudemon.xml");
Assert.True(File.Exists(xmlFilePath));
using (Stream stream = File.OpenRead(xmlFilePath))
{
var deserializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
var result = deserializer.ReadObject(stream) as List<FruitDuDemon>;
Assert.NotNull(result);
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
}
[Fact]
public void GetFDD_ReadsFromFileAndDeserializes()
{
var obj1 = new FruitDuDemon("Fruit 1", "", "", 0, 0, "", "", "");
var obj2 = new FruitDuDemon("Fruit 2", "", "", 0, 0, "", "", "");
var listFDD = new List<FruitDuDemon>
{
obj1,
obj2,
};
string xmlFilePath = Path.Combine(serializer.Chemin, "fruitdudemon.xml");
using (Stream stream = File.Create(xmlFilePath))
{
var xmlSerializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
xmlSerializer.WriteObject(stream, listFDD);
}
// Act
var result = serializer.GetFruits();
// Assert
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
[Fact]
public void SetBestiaire_SerializesAndWritesToFile()
{
/// Arrange
var obj1 = new Bestiaire("Bestiaire 1", "", "", "");
var obj2 = new Bestiaire("Bestiaire 2", "", "", "");
var listBest = new List<Bestiaire>
{
obj1,
obj2,
};
// Act
serializer.SetBestiaire(listBest);
// Assert
string xmlFilePath = Path.Combine(serializer.Chemin, "bestiaire.xml");
Assert.True(File.Exists(xmlFilePath));
using (Stream stream = File.OpenRead(xmlFilePath))
{
var deserializer = new DataContractSerializer(typeof(List<Bestiaire>));
var result = deserializer.ReadObject(stream) as List<Bestiaire>;
Assert.NotNull(result);
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
}
[Fact]
public void GetBestiaire_ReadsFromFileAndDeserializes()
{
// Arrange
var obj1 = new Bestiaire("Bestiaire 1", "", "", "");
var obj2 = new Bestiaire("Bestiaire 2", "", "", "");
var listBest = new List<Bestiaire>
{
obj1,
obj2,
};
string xmlFilePath = Path.Combine(serializer.Chemin, "bestiaire.xml");
using (Stream stream = File.Create(xmlFilePath))
{
var xmlSerializer = new DataContractSerializer(typeof(List<Bestiaire>));
xmlSerializer.WriteObject(stream, listBest);
}
// Act
var result = serializer.GetBestiaires();
// Assert
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
[Fact]
public void SetBateau_SerializesAndWritesToFile()
{
var obj1 = new Bateau("Bateau 1", "", 0, 0, "", "", "");
var obj2 = new Bateau("Bateau 2", "", 0, 0, "", "", "");
var listeBateau = new List<Bateau>
{
obj1,
obj2,
};
serializer.SetBateau(listeBateau);
string xmlFilePath = Path.Combine(serializer.Chemin, "bateau.xml");
Assert.True(File.Exists(xmlFilePath));
using (Stream stream = File.OpenRead(xmlFilePath))
{
var deserializer = new DataContractSerializer(typeof(List<Bateau>));
var result = deserializer.ReadObject(stream) as List<Bateau>;
Assert.NotNull(result);
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
}
[Fact]
public void GetBateau_ReadsFromFileAndDeserializes()
{
var obj1 = new Bateau("Bateau 1", "", 0, 0, "", "", "");
var obj2 = new Bateau("Bateau 2", "", 0, 0, "", "", "");
var listeBateau = new List<Bateau>
{
obj1,
obj2,
};
string xmlFilePath = Path.Combine(serializer.Chemin, "bateau.xml");
using (Stream stream = File.Create(xmlFilePath))
{
var xmlSerializer = new DataContractSerializer(typeof(List<Bateau>));
xmlSerializer.WriteObject(stream, listeBateau);
}
var result = serializer.GetBateaux();
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
[Fact]
public void SetIle_SerializesAndWritesToFile()
{
var obj1 = new Ile("Ile 1", "","", 0, 0, "", "");
var obj2 = new Ile("Ile 2", "", "",0, 0, "", "");
var listeIle = new List<Ile>
{
obj1,
obj2,
};
serializer.SetIle(listeIle);
string xmlFilePath = Path.Combine(serializer.Chemin, "ile.xml");
Assert.True(File.Exists(xmlFilePath));
using (Stream stream = File.OpenRead(xmlFilePath))
{
var deserializer = new DataContractSerializer(typeof(List<Ile>));
var result = deserializer.ReadObject(stream) as List<Ile>;
Assert.NotNull(result);
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
}
[Fact]
public void GetIle_ReadsFromFileAndDeserializes()
{
var obj1 = new Ile("Ile 1", "", "", 0, 0, "", "");
var obj2 = new Ile("Ile 2", "", "", 0, 0, "", "");
var listeIle = new List<Ile>
{
obj1,
obj2,
};
string xmlFilePath = Path.Combine(serializer.Chemin, "ile.xml");
using (Stream stream = File.Create(xmlFilePath))
{
var xmlSerializer = new DataContractSerializer(typeof(List<Ile>));
xmlSerializer.WriteObject(stream, listeIle);
}
var result = serializer.GetIles();
Assert.NotNull(result);
var resultList = result.ToList();
Assert.Contains(obj1, result);
Assert.Contains(obj2, result);
}
}
}
Loading…
Cancel
Save