From 1251dd4a667969168820795f72c2f1ba4a70760e Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Wed, 8 Jun 2022 08:47:46 +0200 Subject: [PATCH] Ajoutez des fichiers projet. --- Beverages/Beverages.csproj | 7 +++++++ Beverages/IBeverage.cs | 12 ++++++++++++ Beverages/IPhysicalProperties.cs | 12 ++++++++++++ Beverages/ISweetener.cs | 12 ++++++++++++ Exercice2.sln | 31 +++++++++++++++++++++++++++++++ Exercice2/Exercice2.csproj | 12 ++++++++++++ Exercice2/Program.cs | 30 ++++++++++++++++++++++++++++++ 7 files changed, 116 insertions(+) create mode 100644 Beverages/Beverages.csproj create mode 100644 Beverages/IBeverage.cs create mode 100644 Beverages/IPhysicalProperties.cs create mode 100644 Beverages/ISweetener.cs create mode 100644 Exercice2.sln create mode 100644 Exercice2/Exercice2.csproj create mode 100644 Exercice2/Program.cs diff --git a/Beverages/Beverages.csproj b/Beverages/Beverages.csproj new file mode 100644 index 0000000..f208d30 --- /dev/null +++ b/Beverages/Beverages.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/Beverages/IBeverage.cs b/Beverages/IBeverage.cs new file mode 100644 index 0000000..7b248d1 --- /dev/null +++ b/Beverages/IBeverage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Beverages +{ + interface IBeverage + { + } +} diff --git a/Beverages/IPhysicalProperties.cs b/Beverages/IPhysicalProperties.cs new file mode 100644 index 0000000..3438756 --- /dev/null +++ b/Beverages/IPhysicalProperties.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Beverages +{ + interface IPhysicalProperties + { + } +} diff --git a/Beverages/ISweetener.cs b/Beverages/ISweetener.cs new file mode 100644 index 0000000..6512511 --- /dev/null +++ b/Beverages/ISweetener.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Beverages +{ + interface ISweetener + { + } +} diff --git a/Exercice2.sln b/Exercice2.sln new file mode 100644 index 0000000..934ee3d --- /dev/null +++ b/Exercice2.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32526.322 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exercice2", ".\Exercice2\Exercice2.csproj", "{97DF561A-2E22-4CB0-9EF1-FC3224AE6DB3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Beverages", ".\Beverages\Beverages.csproj", "{06F28125-D0AD-41EF-BE32-6EAA6622C0EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {97DF561A-2E22-4CB0-9EF1-FC3224AE6DB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97DF561A-2E22-4CB0-9EF1-FC3224AE6DB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97DF561A-2E22-4CB0-9EF1-FC3224AE6DB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97DF561A-2E22-4CB0-9EF1-FC3224AE6DB3}.Release|Any CPU.Build.0 = Release|Any CPU + {06F28125-D0AD-41EF-BE32-6EAA6622C0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {06F28125-D0AD-41EF-BE32-6EAA6622C0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {06F28125-D0AD-41EF-BE32-6EAA6622C0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {06F28125-D0AD-41EF-BE32-6EAA6622C0EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5AEF1449-FFB0-483B-916A-EDB36B12793E} + EndGlobalSection +EndGlobal diff --git a/Exercice2/Exercice2.csproj b/Exercice2/Exercice2.csproj new file mode 100644 index 0000000..d291ca8 --- /dev/null +++ b/Exercice2/Exercice2.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + diff --git a/Exercice2/Program.cs b/Exercice2/Program.cs new file mode 100644 index 0000000..249d39b --- /dev/null +++ b/Exercice2/Program.cs @@ -0,0 +1,30 @@ +using System; +using Beverages; +using System.Diagnostics; + +namespace Exercice2 +{ + internal class Program + { + static void Main(string[] args) + { + IBeverage tea = new Tea(TeaType.Oolong); + Debug.Assert(tea.GetTemperature() > (float)95, "Tea temperature needs be above 95C"); + + ISweetener sugar = new Erythriol(0.5); + tea.Sweeten(sugar); + Debug.Assert(tea.GetSweetenersList().Count == 1, "We put a single sweetener type"); + + IBeverage coffee = new Coffee(CoffeeType.ColdBrew); + Debug.Assert(coffee.GetTemperature() < (float)5, "Coldbrew coffee temperature needs be below 5C"); + + IBeverage horror = new Mix(tea, coffee); + Debug.Assert(horror.GetTemperature() < (float)55, "Horror temperature needs be average of tea and coffee"); + Debug.Assert(horror.GetSweetenersList().Count == 1, "We put a single sweetener type"); + + ISweetener coffeeSugar = new Erythriol(0.5); + coffee.Sweeten(coffeeSugar); + Debug.Assert(horror.GetSweetenersList().Count == 1, "We put a single sweetener type, just more of it"); + } + } +}