You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
4.5 KiB
97 lines
4.5 KiB
using TestAutomation.Utils; |
|
|
|
namespace TestAutomation; |
|
|
|
[TestFixture] |
|
public class TestHarassCalculator : BaseTest |
|
{ |
|
[Test] |
|
public void CalculatorInput() |
|
{ |
|
TestReport.CreateTest(); |
|
|
|
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/harass-calculator"); |
|
|
|
var expectedTotalAlloyHarassment = 240; |
|
|
|
try |
|
{ |
|
Website.HarassCalculatorPage |
|
.SetWorkersLostToHarass(3) |
|
.SetNumberOfTownHallsExisting(2) |
|
.SetTownHallTravelTime(0, 30) |
|
.GetTotalAlloyHarassment(out var foundTotalAlloyHarassment); |
|
|
|
TestReport.CheckPassed(expectedTotalAlloyHarassment.Equals(foundTotalAlloyHarassment), |
|
TestMessage.CreateFailedMessage($"expectTotalAlloyHarassment of {expectedTotalAlloyHarassment} " + |
|
"does not equal " + |
|
$"foundTotalAlloyHarassment of {foundTotalAlloyHarassment} ")); |
|
} |
|
catch (Exception e) |
|
{ |
|
TestReport.CheckPassed(false, |
|
TestMessage.CreateFailedMessage(e.StackTrace!)); |
|
} |
|
} |
|
|
|
[Test] |
|
public void CalculatedExampleInformation() |
|
{ |
|
TestReport.CreateTest(); |
|
|
|
Website.WebDriver.Navigate().GoToUrl(WebsiteUrl + "/harass-calculator"); |
|
|
|
var expectedExampleTotalAlloyLoss = 720; |
|
var expectedExampleWorkerCost = 300; |
|
var expectedExampleMiningTimeCost = 420; |
|
var expectedExampleTotalAlloyLossDifference = 300; |
|
var expectedExampleTotalAlloyLossAccurate = 450; |
|
var expectedExampleTotalAlloyLossAccurateDifference = 270; |
|
|
|
Website.HarassCalculatorPage |
|
.GetExampleTotalAlloyLoss(out var foundTotalAlloyLoss) |
|
.GetExampleWorkerCost(out var foundExampleWorkerCost) |
|
.GetExampleMiningTimeCost(out var foundExampleMiningTimeCost) |
|
.GetExampleTotalAlloyLossAccurate(out var foundExampleTotalAlloyLossAccurate) |
|
.GetExampleTotalAlloyLossDifference(out var foundGetExampleTotalAlloyLossDifference) |
|
.GetExampleTotalAlloyLossAccurateDifference(out var foundExampleTotalAlloyLossAccurateDifference); |
|
|
|
TestReport.CheckPassed(expectedExampleTotalAlloyLoss.Equals(foundTotalAlloyLoss), |
|
TestMessage.CreateFailedMessage($"expectedExampleTotalAlloyLoss of {expectedExampleTotalAlloyLoss} " + |
|
"does not equal " + |
|
$"foundTotalAlloyLoss of {foundTotalAlloyLoss} ")); |
|
|
|
TestReport.CheckPassed(expectedExampleWorkerCost.Equals(foundExampleWorkerCost), |
|
TestMessage.CreateFailedMessage($"expectedExampleWorkerCost of {expectedExampleWorkerCost} " + |
|
"does not equal " + |
|
$"foundExampleWorkerCost of {foundExampleWorkerCost} ")); |
|
|
|
|
|
TestReport.CheckPassed(expectedExampleMiningTimeCost.Equals(foundExampleMiningTimeCost), |
|
TestMessage.CreateFailedMessage($"expectedExampleMiningTimeCost of {expectedExampleMiningTimeCost} " + |
|
"does not equal " + |
|
$"foundExampleMiningTimeCost of {foundExampleMiningTimeCost} ")); |
|
|
|
|
|
TestReport.CheckPassed(expectedExampleTotalAlloyLossAccurate.Equals(foundExampleTotalAlloyLossAccurate), |
|
TestMessage.CreateFailedMessage( |
|
$"expectedExampleTotalAlloyLossAccurate of {expectedExampleTotalAlloyLossAccurate} " + |
|
"does not equal " + |
|
$"foundExampleTotalAlloyLossAccurate of {foundExampleTotalAlloyLossAccurate} ")); |
|
|
|
|
|
TestReport.CheckPassed(expectedExampleTotalAlloyLossDifference.Equals(foundGetExampleTotalAlloyLossDifference), |
|
TestMessage.CreateFailedMessage( |
|
$"expectedExampleTotalAlloyLossDifference of {expectedExampleTotalAlloyLossDifference} " + |
|
"does not equal " + |
|
$"foundGetExampleTotalAlloyLossDifference of {foundGetExampleTotalAlloyLossDifference} ")); |
|
|
|
|
|
TestReport.CheckPassed( |
|
expectedExampleTotalAlloyLossAccurateDifference.Equals(foundExampleTotalAlloyLossAccurateDifference), |
|
TestMessage.CreateFailedMessage( |
|
$"expectedExampleTotalAlloyLossAccurateDifference of {expectedExampleTotalAlloyLossAccurateDifference} " + |
|
"does not equal " + |
|
$"foundExampleTotalAlloyLossAccurateDifference of {foundExampleTotalAlloyLossAccurateDifference} ")); |
|
} |
|
} |