| @ -0,0 +1,7 @@ | |||||
| <Project Sdk="Microsoft.NET.Sdk"> | |||||
| <PropertyGroup> | |||||
| <TargetFramework>net5.0</TargetFramework> | |||||
| </PropertyGroup> | |||||
| </Project> | |||||
| @ -0,0 +1,12 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Beverages | |||||
| { | |||||
| interface IBeverage | |||||
| { | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,12 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Beverages | |||||
| { | |||||
| interface IPhysicalProperties | |||||
| { | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,12 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Beverages | |||||
| { | |||||
| interface ISweetener | |||||
| { | |||||
| } | |||||
| } | |||||
| @ -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 | |||||
| @ -0,0 +1,12 @@ | |||||
| <Project Sdk="Microsoft.NET.Sdk"> | |||||
| <PropertyGroup> | |||||
| <OutputType>Exe</OutputType> | |||||
| <TargetFramework>net5.0</TargetFramework> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\Beverages\Beverages.csproj" /> | |||||
| </ItemGroup> | |||||
| </Project> | |||||
| @ -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"); | |||||
| } | |||||
| } | |||||
| } | |||||