diff --git a/Helios/Source/SolarPanel.cs b/Helios/Source/SolarPanel.cs index 4dcb9ad0c10aff54fecc7a9cfc6bc105c98a2623..b59b44a40181eb342235eb34a251449ba15cd371 100644 --- a/Helios/Source/SolarPanel.cs +++ b/Helios/Source/SolarPanel.cs @@ -47,7 +47,7 @@ namespace Helios.Source { double costPerWatt; - costPerWatt = this.InstallationCost * this.PowerOutput; + costPerWatt = this.InstallationCost / this.PowerOutput; this.CostPerWatt = costPerWatt; diff --git a/UnitTests/ConfiguratorTests.cs b/UnitTests/ConfiguratorTests.cs index 2245f2183bd3e8d3e1ba2ebf9c3b01720fa92062..4c0ae72a39591ec01b54413880853b981f9182d0 100644 --- a/UnitTests/ConfiguratorTests.cs +++ b/UnitTests/ConfiguratorTests.cs @@ -1,20 +1,70 @@ using System; +using Helios.Models; +using Helios.Source; using NUnit.Framework; namespace UnitTests { public class ConfiguratorTests { - [SetUp] - public void Setup() + [Test] + public void GetElevationAngle_SunAngle_ReturnsAngle() + { + Roof roof = new Roof(); + roof.Elevation = 25; + + int elevationAngle = roof.GetElevationAngle(60); + + Assert.AreEqual(85, elevationAngle); + } + + [Test] + public void GetPowerOutput_MockNumbers_ReturnsExpected() + { + SolarPanel panel = new SolarPanel(); + panel.Efficiency = 0.2; + + int solarEnergy = 1000; + int roofArea = 7; + int roofElevation = 85; + + double powerOutput = panel.GetPowerOutput(solarEnergy, roofArea, roofElevation); + + Assert.AreEqual(1394.67, Math.Round(powerOutput, 2)); + } + + [Test] + public void GetInstallationCost_MockArea_ReturnExpected() { + SolarPanel panel = new SolarPanel(); + panel.CostPerMetreSquared = 100; + + int roofArea = 7; + + double installationCost = panel.GetInstallationCost(roofArea); + + Assert.AreEqual(700, installationCost); } [Test] - public void Test1() + public void GetCostPerWatt_MockPanel_ReturnExpected() { - Assert.Pass(); + SolarPanel panel = new SolarPanel(); + panel.Efficiency = 0.2; + panel.CostPerMetreSquared = 100; + + int solarEnergy = 1000; + int roofArea = 7; + int roofElevation = 85; + + panel.GetInstallationCost(7); + panel.GetPowerOutput(solarEnergy, roofArea, roofElevation); + + double costPerWatt = panel.GetCostPerWatt(); + + Assert.AreEqual(0.50, Math.Round(costPerWatt, 2)); } + } } diff --git a/UnitTests/PowerDistributionTests.cs b/UnitTests/PowerDistributionTests.cs index 3ee39f6d7974c30207933232da062fb3c9ec78ac..e7e93e1619a877c0d3befc8ebe275597cb19b186 100644 --- a/UnitTests/PowerDistributionTests.cs +++ b/UnitTests/PowerDistributionTests.cs @@ -3,18 +3,44 @@ using NUnit.Framework; namespace UnitTests { - public class PowerDistributionTests + public class PowerDistributionTests { - [SetUp] - public void Setup() + [Test] + public void GetPowerOutput_MockNumbers_ReturnsExpected() + { + Assert.Pass(); + } + + [Test] + public void GetBaseLoad_MockNumbers_ReturnsExpected () { + Assert.Pass(); + } + + [Test] + public void GetPowerBalence_MockNumbers_ReturnsExpected() + { + Assert.Pass(); } [Test] - public void Test1() + public void GetCharge_MockNumbers_ReturnsExpected() { Assert.Pass(); } + + [Test] + public void GetStateOfChargeAtTime_MockNumbers_ReturnsExpected() + { + Assert.Pass(); + } + + [Test] + public void GetDepthOfDischarge_MockNumbers_ReturnsExpected() + { + Assert.Pass(); + } + } } diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index e59718eece009ddafa4617b9a6cea55c4dda04b6..1853ebcc5302866acbec7c8f70309d563d2b5788 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -14,4 +14,7 @@ <PackageReference Include="coverlet.collector" Version="3.1.0" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Helios\Helios.csproj" /> + </ItemGroup> </Project>