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

Add Configurator unit tests

parent bf3744dd
No related branches found
No related tags found
No related merge requests found
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));
}
}
}
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