public void Kata_FamilyA() { // Arrange. var familyHourlyRate = new FamilyHourlyRate { StartTime = new TimeSpan(23, 0, 0), // 11:00PM HourlyRate = 20 }; Family.DefaultHourlyRate = 15; Family.AddFamilyHourlyRate(familyHourlyRate); Babysitter.AddJob(Job); // Act. var totalPay = Babysitter.CalculatePayForJob(Job); // Assert. var expectedTotalPay = 190; Assert.AreEqual(expectedTotalPay, totalPay); }
public void Family_AddFamilyHourlyRate_SuccessfullyAddsFamilyHourlyRate() { // Arrange. var family = new Family(); var familyHourlyRate = new FamilyHourlyRate(); // Act. family.AddFamilyHourlyRate(familyHourlyRate); // Assert. var expectedFamilyHourlyRates = 1; Assert.AreEqual(expectedFamilyHourlyRates, family.FamilyHourlyRates.Count); }
public void Job_CalculatePay_ReturnsCorrectPay() { // Arrange. var familyHourlyRate = new FamilyHourlyRate { StartTime = new TimeSpan(23, 0, 0), // 11:00PM HourlyRate = 20 }; var family = new Family { DefaultHourlyRate = 15 }; family.AddFamilyHourlyRate(familyHourlyRate); var job = new Job { StartDateTime = new DateTime(2019, 6, 20, 17, 0, 0), // 6/20/2019 5:00PM EndDateTime = new DateTime(2019, 6, 21, 4, 0, 0), // 6/21/2019 4:00AM Family = family }; var babySitter = new Babysitter { MinimumStartTime = new TimeSpan(17, 0, 0), // 5:00PM MaximumEndTime = new TimeSpan(4, 0, 0) // 4:00AM }; babySitter.AddJob(job); // Act. var totalPay = babySitter.CalculatePayForJob(job); // Assert. var expectedTotalPay = 190; Assert.AreEqual(expectedTotalPay, totalPay); }