Skip to content
Snippets Groups Projects
Commit 33eba140 authored by Daniel Lorych's avatar Daniel Lorych :cookie:
Browse files

Merge branch '63-implement-unit-tests' into 'main'

Resolve "Implement unit tests"

Closes #63

See merge request d2-lorych/helios!15
parents d50c2c63 931e8748
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,7 @@ namespace Helios.Source
{
double costPerWatt;
costPerWatt = this.InstallationCost * this.PowerOutput;
costPerWatt = this.InstallationCost / this.PowerOutput;
this.CostPerWatt = costPerWatt;
......
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));
}
}
}
......@@ -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();
}
}
}
......@@ -14,4 +14,7 @@
<PackageReference Include="coverlet.collector" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Helios\Helios.csproj" />
</ItemGroup>
</Project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment