public void Total_GivenNoItems_ReturnZero() { var properties = JobPropertiesForTest(new List <JobItem>()); var actual = new JobCalculator(properties).Total; Assert.Equal(0m, actual); }
public void Total_GivenAnItem_CalculateTotalToNearestEvenCent() { var items = new List <JobItem> { new JobItem(string.Empty, 100.04m, false) }; var actual = new JobCalculator(JobPropertiesForTest(items, true)).Total; Assert.Equal(123.04m, actual); }
public void Total_GivenExemptItemAndExtraMargin_ReturnTotalOf116() { var items = new List <JobItem> { new JobItem(string.Empty, 100m, true) }; var actual = new JobCalculator(JobPropertiesForTest(items, true)).Total; Assert.Equal(116m, actual); }
public void Total_GivenNonExemptItemAndNoExtraMargin_Return118() { var items = new List <JobItem> { new JobItem(string.Empty, 100m, false) }; var actual = new JobCalculator(JobPropertiesForTest(items, false)).Total; Assert.Equal(118m, actual); }
static void ProcessJobs(int index) { Console.WriteLine("\nJob {0} Output\n", index); JobParser job1 = new JobParser($"../../JobFiles/Job{index}.txt"); job1.LoadJobElements(); JobComponents temp = job1.getJob(0); List <JobComponents> test = job1.getJobAllElements().ToList(); JobCalculator pCalc = new JobCalculator(temp, test); pCalc.DumpOutput(index); }
public void Output_GivenTwoItemsAnd200Total_ProduceExpectedOutput() { const string Expected = "envelopes: $556.40\nletterhead: $1983.37\ntotal: $2940.30"; var items = new List <JobItem> { new JobItem("envelopes", 520, false), new JobItem("letterhead", 1983.37m, true) }; var subject = new JobCalculator(JobPropertiesForTest(items, true)); var actual = subject.Output; Assert.Equal(Expected, actual); }
public void Job1JobCalculatorTestMethod() { JobParser job1 = new JobParser("../../JobFiles/Job1.txt"); job1.LoadJobElements(); JobComponents temp = job1.getJob(0); List <JobComponents> test = job1.getJobAllElements().ToList(); JobCalculator pCalc = new JobCalculator(temp, test); pCalc.DumpOutput(1); decimal total = 2940.30m; Assert.AreEqual(total, pCalc.CalculateTotal()); }
public CalculatorTests() { _jobService = new JobCalculator(); }