public void PayInAmount_GivenValidAmount_UpdateBalanceAndPaidInAmount() { var sut = new AccountBuilder().WithBalance(0).Build(); sut.PayInAmount(0.01m); Assert.Equal(0.01m, sut.Balance); Assert.Equal(0.01m, sut.PaidIn); }
public void PayInAmount_GivenPayInLimitDifferenceThresholdNotExceeded_DoNotNotifyUser() { var notificationServiceMock = new Mock <INotificationService>(); var user = new User(notificationServiceMock.Object); var sut = new AccountBuilder() .WithUser(user) .WithPaidIn(Account.PayInLimit - Account.PayInLimitDifferenceThreshold - 0.01m) .Build(); sut.PayInAmount(0.01m); notificationServiceMock.Verify(service => service.NotifyApproachingPayInLimit(It.IsAny <string>()), Times.Never); }
public void PayInAmount_GivenPayInLimitDifferenceThresholdExceeded_NotifyUser() { var notificationServiceMock = new Mock <INotificationService>(); var user = new User(notificationServiceMock.Object); user.Email = "*****@*****.**"; var sut = new AccountBuilder() .WithUser(user) .WithPaidIn(Account.PayInLimit - Account.PayInLimitDifferenceThreshold) .Build(); sut.PayInAmount(0.01m); notificationServiceMock.Verify(service => service.NotifyApproachingPayInLimit(user.Email)); }
public void PayInAmount_GivenInvalidAmount_ThrowException() { var sut = new AccountBuilder().WithPaidIn(Account.PayInLimit).Build(); Assert.Throws <InvalidOperationException>(() => sut.PayInAmount(0.01m)); }