Tests unitaires, nouvelles pages d'acceuil + implementation persistance sur ajouter, modifier et supprimer
continuous-integration/drone/push Build is failing Details

pull/15/head
Yoan 2 years ago
parent fb8b0927e2
commit 2608b25088

@ -21,7 +21,6 @@ namespace Model.Classes
get => nomromanise; get => nomromanise;
set set
{ {
if (nomromanise == value) return;
nomromanise = value; nomromanise = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -32,7 +31,6 @@ namespace Model.Classes
get=> region; get=> region;
set set
{ {
if (region == value) return;
region = value; region = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -43,7 +41,6 @@ namespace Model.Classes
get=>premierchap; get=>premierchap;
set set
{ {
if(premierchap == value) return;
premierchap = value; premierchap = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -54,7 +51,6 @@ namespace Model.Classes
get=>premierep; get=>premierep;
set set
{ {
if(premierep == value) return;
premierep = value; premierep = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -65,7 +61,6 @@ namespace Model.Classes
get=>statut; get=>statut;
set set
{ {
if (statut == value) return;
statut = value; statut = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -76,7 +71,6 @@ namespace Model.Classes
get=>description; get=>description;
set set
{ {
if(description == value) return;
description = value; description = value;
OnPropertyChanged(); OnPropertyChanged();
} }

@ -19,7 +19,6 @@ namespace Model.Classes
get=>nomromanise; get=>nomromanise;
set set
{ {
if(nomromanise==value) return;
nomromanise = value; nomromanise = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -30,7 +29,6 @@ namespace Model.Classes
get=>type; get=>type;
set set
{ {
if(type==value) return;
type = value; type = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -41,7 +39,6 @@ namespace Model.Classes
get=>premierchap; get=>premierchap;
set set
{ {
if(premierchap==value) return;
premierchap = value; premierchap = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -52,7 +49,6 @@ namespace Model.Classes
get=>premierep; get=>premierep;
set set
{ {
if (premierep==value) return;
premierep=value; premierep=value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -63,7 +59,6 @@ namespace Model.Classes
get=>description; get=>description;
set set
{ {
if (description==value) return;
description = value; description = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -74,7 +69,6 @@ namespace Model.Classes
get=>forces; get=>forces;
set set
{ {
if (forces==value) return;
forces = value; forces = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -85,7 +79,6 @@ namespace Model.Classes
get=>faiblesses; get=>faiblesses;
set set
{ {
if (faiblesses == value) return;
faiblesses = value; faiblesses = value;
OnPropertyChanged(); OnPropertyChanged();
} }

@ -20,7 +20,6 @@ namespace Model.Classes
get => nomromanise; get => nomromanise;
set set
{ {
if (nomromanise == value) return;
nomromanise = value; nomromanise = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -32,7 +31,6 @@ namespace Model.Classes
get=>region; get=>region;
set set
{ {
if (region == value) return;
region = value; region = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -43,7 +41,6 @@ namespace Model.Classes
get=>premierchap; get=>premierchap;
set set
{ {
if(premierchap == value) return;
premierchap = value; premierchap = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -54,7 +51,6 @@ namespace Model.Classes
get=>premierep; get=>premierep;
set set
{ {
if(premierep == value) return;
premierep = value; premierep = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -65,7 +61,6 @@ namespace Model.Classes
get=>description; get=>description;
set set
{ {
if (description == value) return;
description = value; description = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -76,7 +71,6 @@ namespace Model.Classes
get=>geographie; get=>geographie;
set set
{ {
if (geographie == value) return;
geographie = value; geographie = value;
OnPropertyChanged(); OnPropertyChanged();
} }

@ -15,10 +15,6 @@ namespace Model.Classes
get=>prime; get=>prime;
set set
{ {
if (prime == value)
{
return;
}
prime = value; prime = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -29,10 +25,6 @@ namespace Model.Classes
get=>epithete; get=>epithete;
set set
{ {
if (epithete == value)
{
return;
}
epithete = value; epithete = value;
} }
} }
@ -42,10 +34,6 @@ namespace Model.Classes
get=>age; get=>age;
set set
{ {
if (age == value)
{
return;
}
age = value; age = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -56,10 +44,6 @@ namespace Model.Classes
get=>taille; get=>taille;
set set
{ {
if (taille == value)
{
return;
}
taille = value; taille = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -70,10 +54,6 @@ namespace Model.Classes
get=>origine; get=>origine;
set set
{ {
if (origine == value)
{
return;
}
origine = value; origine = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -84,10 +64,6 @@ namespace Model.Classes
get=>biographie; get=>biographie;
set set
{ {
if (biographie == value)
{
return;
}
biographie = value; biographie = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -98,10 +74,6 @@ namespace Model.Classes
get=>citation; get=>citation;
set set
{ {
if (citation == value)
{
return;
}
citation = value; citation = value;
OnPropertyChanged(); OnPropertyChanged();
} }
@ -112,10 +84,6 @@ namespace Model.Classes
get => equipage; get => equipage;
set set
{ {
if (equipage == value)
{
return;
}
equipage = value; equipage = value;
OnPropertyChanged(); OnPropertyChanged();
} }

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

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

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

@ -4,28 +4,53 @@
x:Class="Ohara.MainPage" x:Class="Ohara.MainPage"
BackgroundColor="#e2edf1"> BackgroundColor="#e2edf1">
<ScrollView> <ScrollView>
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Spacing="40" Margin="0,20,0,0"> <VerticalStackLayout Spacing="50" Padding="30">
<Frame CornerRadius="20" HorizontalOptions="Center" Padding="30" BorderColor="Transparent">
<Label Text="Bienvenue dans Ohara !" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" TextColor="White"/> <Grid HeightRequest="500" HorizontalOptions="Center" MaximumWidthRequest="1000" >
<Frame.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <Frame CornerRadius="25"
<GradientStop Color="#cdffd8" Offset="0.1" /> BorderColor="Transparent"
<GradientStop Color="#94b9ff" Offset="1.0" /> BackgroundColor="Black"
</LinearGradientBrush> IsClippedToBounds="True"
</Frame.Background> Padding="0">
<Image Source="ohara.jpg" Opacity="0.6" Aspect="Fill"/>
</Frame> </Frame>
<Frame CornerRadius="20" Padding="20" HorizontalOptions="Center" BackgroundColor="#72a3b3" BorderColor="#72a3b3" Margin="50"> <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>
<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"> <VerticalStackLayout Spacing="10">
<Label Text="Présentation :" FontAttributes="Bold" FontSize="30" HorizontalOptions="Center" VerticalOptions="Start" TextColor="White"/> <Label Text="Présentation de l'application :" FontAttributes="Bold" FontSize="25" VerticalOptions="Start" TextColor="#72a3b3" HorizontalTextAlignment="Center"/>
<Label TextColor="White" Grid.Column="1" FontSize="17" VerticalOptions="Center" HorizontalTextAlignment="Center" > <Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="2" Stroke="#72a3b3" />
<Label TextColor="#72a3b3" FontSize="17" HorizontalTextAlignment="Center" >
<Label.Text> <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. 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.
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.Text>
</Label> </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>
</Frame>
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>

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

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

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

@ -8,20 +8,10 @@
<VerticalStackLayout Spacing="40"> <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"/> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/> <Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="4"/>
<Picker Title="Filtrer" Grid.Column="4" ItemsSource="{Binding Equipages}" ItemDisplayBinding="{Binding Nom}" SelectedIndexChanged="PickerFiltre_SelectedIndexChanged" Style="{StaticResource pickerOhara}"/> <Picker Title="Filtrer" Grid.Column="2" 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>
</Grid> </Grid>
<ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always"> <ScrollView Orientation="Horizontal" HorizontalScrollBarVisibility="Always">
<CollectionView x:Name="listeBateau" ItemsSource="{Binding Bateaux}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBateau_SelectionChanged" > <CollectionView x:Name="listeBateau" ItemsSource="{Binding Bateaux}" ItemsLayout="HorizontalList" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBateau_SelectionChanged" >

@ -8,28 +8,9 @@
<ScrollView> <ScrollView>
<VerticalStackLayout> <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"/> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="ButtonAjouter_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/> <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> </Grid>
<FlexLayout x:Name="listeBest" AlignItems="Center" Wrap="Wrap" <FlexLayout x:Name="listeBest" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center" HorizontalOptions="Center"

@ -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"> BackgroundColor="#e2edf1">
<ScrollView> <ScrollView>
<VerticalStackLayout> <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"/> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/>
<Button Text="Ajouter" Clicked="ButtonAjouter_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="2"/> <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> </Grid>
<FlexLayout x:Name="listEquip" AlignItems="Center" Wrap="Wrap" <FlexLayout x:Name="listEquip" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center" JustifyContent="SpaceEvenly"> HorizontalOptions="Center" JustifyContent="SpaceEvenly">

@ -7,10 +7,10 @@
BackgroundColor="#e2edf1"> BackgroundColor="#e2edf1">
<ScrollView> <ScrollView>
<VerticalStackLayout> <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"/> <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> <Picker.ItemsSource>
<x:Array Type="{x:Type x:String}"> <x:Array Type="{x:Type x:String}">
<x:String>Aucun</x:String> <x:String>Aucun</x:String>
@ -21,14 +21,7 @@
</x:Array> </x:Array>
</Picker.ItemsSource> </Picker.ItemsSource>
</Picker> </Picker>
<Picker Title="Trier" Grid.Column="6" Style="{StaticResource pickerOhara}"> <Button Text="Ajouter" Clicked="Button_Clicked" Style="{StaticResource buttonBarre}" Grid.Column="4"/>
<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> </Grid>
<FlexLayout x:Name="listeFDD" AlignItems="Center" Wrap="Wrap" <FlexLayout x:Name="listeFDD" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center" HorizontalOptions="Center"

@ -8,28 +8,9 @@
<ScrollView> <ScrollView>
<VerticalStackLayout> <VerticalStackLayout>
<Grid ColumnDefinitions="200,*,150,20,150,20,150" BackgroundColor="#72a3b3" Padding="10"> <Grid ColumnDefinitions="*" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" Grid.Column="0"/> <SearchBar x:Name="searchBar" Placeholder="Rechercher..." Style="{StaticResource searchBarOhara}" HorizontalOptions="Center" WidthRequest="300"/>
<!--<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> </Grid>
<FlexLayout x:Name="listeFav" AlignItems="Center" Wrap="Wrap" <FlexLayout x:Name="listeFav" AlignItems="Center" Wrap="Wrap"
HorizontalOptions="Center" JustifyContent="SpaceEvenly"> HorizontalOptions="Center" JustifyContent="SpaceEvenly">

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

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

@ -28,9 +28,14 @@ namespace TestProject1
{ {
Bestiaire bestiaire1 = new Bestiaire("Humains", "??", "Les humains sont ...", "Ils possèdent les caractéristiques suivantes ...", ""); 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 ...", ""); 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 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.True(resultat, "Les deux bestiaires devraient etre égaux car ils onts le meme nom");
Assert.False(resultat2);
Assert.False(resultat3);
} }
} }
} }

@ -114,8 +114,237 @@ namespace TestProject1
Assert.True(1==result.Count); Assert.True(1==result.Count);
Assert.Contains(obj1, result); Assert.Contains(obj1, result);
Assert.False(result.Contains(obj2)); 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);
}
} }
} }

@ -12,41 +12,36 @@ namespace TestProject1
[Fact] [Fact]
public void ToString_ReturnsCorrectStringRepresentation() public void ToString_ReturnsCorrectStringRepresentation()
{ {
// Arrange
var obj = new ObjetOhara("Objet 1", "image.png", true); var obj = new ObjetOhara("Objet 1", "image.png", true);
// Act
var result = obj.ToString(); var result = obj.ToString();
// Assert
Assert.True("ObjetOhara : Objet 1 True image.png"== result); Assert.True("ObjetOhara : Objet 1 True image.png"== result);
} }
[Fact] [Fact]
public void Equals_SameObject_ReturnsTrue() public void Equals_SameObject_ReturnsTrue()
{ {
// Arrange
var obj = new ObjetOhara("Objet 1"); var obj = new ObjetOhara("Objet 1");
var obj2 = new ObjetOhara("Objet 2");
// Act var obj3 = new Bateau("Objet 3", "", 0, 0, "","");
var result = obj.Equals(obj); var result = obj.Equals(obj);
var result2 = obj.Equals(obj2);
// Assert var result3 = obj.Equals(obj3);
Assert.True(result); Assert.True(result);
Assert.False(result2);
Assert.False(result3);
} }
[Fact] [Fact]
public void GetHashCode_ObjectsWithSameProperties_ReturnsSameHashCode() public void GetHashCode_ObjectsWithSameProperties_ReturnsSameHashCode()
{ {
// Arrange
var obj1 = new ObjetOhara("Objet 1", "image.png", true); var obj1 = new ObjetOhara("Objet 1", "image.png", true);
var obj2 = new ObjetOhara("Objet 1", "image.png", true); var obj2 = new ObjetOhara("Objet 1", "image.png", true);
// Act
var hashCode1 = obj1.GetHashCode(); var hashCode1 = obj1.GetHashCode();
var hashCode2 = obj2.GetHashCode(); var hashCode2 = obj2.GetHashCode();
// Assert
Assert.True(hashCode1==hashCode2); Assert.True(hashCode1==hashCode2);
} }
} }

@ -16,7 +16,6 @@ namespace TestProject1
[Fact] [Fact]
public void SetPersonnage_SerializesAndWritesToFile() public void SetPersonnage_SerializesAndWritesToFile()
{ {
/// Arrange
var obj1 = new Personnage("Personnage 1", 0, "", 0, 0, "", "", ""); var obj1 = new Personnage("Personnage 1", 0, "", 0, 0, "", "", "");
var obj2 = new Personnage("Personnage 2", 0, "", 0, 0, "", "", ""); var obj2 = new Personnage("Personnage 2", 0, "", 0, 0, "", "", "");
var listePerso = new List<Personnage> var listePerso = new List<Personnage>
@ -25,10 +24,8 @@ namespace TestProject1
obj2, obj2,
}; };
// Act
serializer.SetPersonnage(listePerso); serializer.SetPersonnage(listePerso);
// Assert
string xmlFilePath = Path.Combine(serializer.Chemin, "personnage.xml"); string xmlFilePath = Path.Combine(serializer.Chemin, "personnage.xml");
Assert.True(File.Exists(xmlFilePath)); Assert.True(File.Exists(xmlFilePath));
@ -47,7 +44,6 @@ namespace TestProject1
[Fact] [Fact]
public void GetPersonnages_ReadsFromFileAndDeserializes() public void GetPersonnages_ReadsFromFileAndDeserializes()
{ {
// Arrange
var obj1 = new Personnage("Personnage 1", 0, "", 0, 0, "", "", ""); var obj1 = new Personnage("Personnage 1", 0, "", 0, 0, "", "", "");
var obj2 = new Personnage("Personnage 2", 0, "", 0, 0, "", "", ""); var obj2 = new Personnage("Personnage 2", 0, "", 0, 0, "", "", "");
var listePerso = new List<Personnage> var listePerso = new List<Personnage>
@ -62,10 +58,287 @@ namespace TestProject1
xmlSerializer.WriteObject(stream, listePerso); xmlSerializer.WriteObject(stream, listePerso);
} }
// Act
var result = serializer.GetPersonnages(); 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 // 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, "bateaux.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, "bateaux.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, "iles.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, "iles.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); Assert.NotNull(result);
var resultList = result.ToList(); var resultList = result.ToList();
Assert.Contains(obj1, result); Assert.Contains(obj1, result);

Loading…
Cancel
Save