You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
6.4 KiB
138 lines
6.4 KiB
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DataPersistence
|
|
{
|
|
/// <summary>
|
|
/// The subs class is a group of prefabricated object that can only be loaded. It only use is for testing.
|
|
/// </summary>
|
|
public class Stubs : IDataManager
|
|
{
|
|
public Dictionary<string, List<object>> Load()
|
|
{
|
|
PasswordManager passwordManager = new PasswordManager();
|
|
|
|
Dictionary<string, List<object>> data = new Dictionary<string, List<object>>
|
|
{
|
|
{
|
|
#region Data: Recipes
|
|
nameof(Recipe),
|
|
new List<object>(new[]
|
|
{
|
|
new Recipe(
|
|
title: "Cookies classiques", id: null,
|
|
ingredients: new List<Ingredient>(new[]
|
|
{
|
|
new Ingredient("Patates", new Quantity(23, Unit.unit)),
|
|
new Ingredient("Farine", new Quantity(23, Unit.G))
|
|
}),
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Faire cuire."),
|
|
new PreparationStep(2, "Manger.")
|
|
}),
|
|
new Recipe(
|
|
title: "Cookies au chocolat", id: null,
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Moulinez la pâte."),
|
|
new PreparationStep(2, "Faire cuire pendant une bonne heure."),
|
|
new PreparationStep(3, "Sortir du four et mettre dans un plat.")
|
|
}),
|
|
new Recipe(
|
|
title: "Gateau nature", id: null,
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Achetez les ingrédients."),
|
|
new PreparationStep(2, "Préparez le matériel. Ustensiles et tout."),
|
|
new PreparationStep(3, "Pleurez.")
|
|
}),
|
|
new Recipe(
|
|
title: "Gateau au pommes", id: null,
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Achetez les légumes."),
|
|
new PreparationStep(2, "Préparez le plat. Ustensiles et préchauffez le four."),
|
|
new PreparationStep(3, "Coupez les pommes en morceaux et disposez-les sur le plat."),
|
|
new PreparationStep(4, "Mettez enfin le plat au four, puis une fois cuit, dégustez !")
|
|
}),
|
|
new Recipe(
|
|
title: "Gateau au chocolat", id: null,
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Ajouter les oeufs."),
|
|
new PreparationStep(2, "Ajouter la farine."),
|
|
new PreparationStep(3, "Ajouter 100g de chocolat fondu."),
|
|
new PreparationStep(4, "Mélanger le tout."),
|
|
new PreparationStep(5, "Faire cuire 45h au four traditionnel.")
|
|
}),
|
|
new Recipe(
|
|
title: "Dinde au jambon", id: null,
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Faire une cuisson bien sec de la dinde à la poêle"),
|
|
new PreparationStep(2, "Mettre la dinde au frigo."),
|
|
new PreparationStep(3, "Mettre le jambon dans le micro-onde."),
|
|
new PreparationStep(4, "Faire chauffer 3min."),
|
|
new PreparationStep(5, "Présentez sur un plat la dinde et le jambon : Miam !")
|
|
}),
|
|
new Recipe(
|
|
title: "Poulet au curry", id: null,
|
|
preparationSteps: new[]
|
|
{
|
|
new PreparationStep(1, "Trouvez des épices de curry."),
|
|
new PreparationStep(2, "Trouvez maintenant du poulet."),
|
|
new PreparationStep(3, "Coupez la tête du poulet et posez-la dans un plat."),
|
|
new PreparationStep(4, "Parsemez d'épices curry la tête de la poule."),
|
|
new PreparationStep(5, "Mettre le tout au four traditionnel 30min."),
|
|
new PreparationStep(6, "Dégustez en famille !")
|
|
})
|
|
})
|
|
#endregion
|
|
},
|
|
{
|
|
#region Data: User
|
|
nameof(User),
|
|
new List<object>(new[]
|
|
{
|
|
new User(
|
|
name: "Admin",
|
|
surname: "Admin",
|
|
mail: "admin@mctg.fr",
|
|
password: passwordManager.HashPassword("admin")),
|
|
new User(
|
|
name: "Pedros",
|
|
surname: "Amigos",
|
|
mail: "pedrosamigos@hotmail.com",
|
|
password: passwordManager.HashPassword("pamigos"))
|
|
})
|
|
#endregion
|
|
}
|
|
};
|
|
|
|
return data;
|
|
}
|
|
|
|
#region Not supported methods
|
|
public void Save(Dictionary<string, List<object>> elements)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public void Export<T>(T obj, string pathToExport) where T : class
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
public KeyValuePair<string, T> Import<T>(string pathToImport) where T : class
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|