public void NotSetNewMonth_WhenMonthlyFeeIsNotPaid(int year, int month, int day) { // Arrange var sut = new MonthlyFeeCalculator(new BaseTestCalculator()); var date = new DateTime(year, month, day); var testTransaction = new Transaction(date, "testMerchant", 0) { Fee = 0 }; sut.CalculateFee(testTransaction); var oldDate = sut.GetLastPaidMonth(); var newDate = new DateTime(year, month, day); var newTestTransaction = new Transaction(newDate, "testMerchant", 0) { Fee = 0 }; // Act sut.CalculateFee(newTestTransaction); // var lastPaidMonth = sut.GetLastPaidMonth(); newDate = newDate.AddDays(-newDate.Day + 1); // Assert Assert.Equal(newDate, lastPaidMonth); Assert.Equal(oldDate, lastPaidMonth); }
public void ReturnBaseFee_IfMonthlyFeeAlreadyPaid(decimal fee) { // Arrange var sut = new MonthlyFeeCalculator(new BaseTestCalculator()); var date = new DateTime(2010, 10, 10); var testTransaction = new Transaction(date, "testMerchant", 0) { Fee = fee }; sut.CalculateFee(testTransaction); // Act var result = sut.CalculateFee(testTransaction); // Assert Assert.Equal(fee, result); }
public void AddMonthlyFee_IfItWasNotAlreadyPaid(decimal fee) { // Arrange var sut = new MonthlyFeeCalculator(new BaseTestCalculator()); var date = new DateTime(2010, 10, 10); var testTransaction = new Transaction(date, "testMerchant", 0) { Fee = fee }; var expectedResult = fee + sut.GetMonthlyFeeAmount(); // Act var result = sut.CalculateFee(testTransaction); // Assert Assert.Equal(expectedResult, result); }