예제 #1
0
        public void GetMonthlyFee_NewMonth_FixedFee()
        {
            _configMock.Setup(x => x.Value)
            .Returns(new AppSettings {
                InvoiceFixedFee = 15
            });

            var transaction = new Transaction {
                Date = new DateTime(2019, 7, 15), MerchantName = "CIRCLE_K", Amount = 100m
            };

            _sut = new MonthlyCharger(_configMock.Object);
            var result = _sut.GetMonthlyFee(transaction);

            result.Should().Be(15);
        }
예제 #2
0
        public void GetMonthlyFee_SixTransactions_FourWithFixedFee()
        {
            _configMock.Setup(x => x.Value)
            .Returns(new AppSettings {
                InvoiceFixedFee = 15
            });

            var transaction1 = new Transaction {
                Date = new DateTime(2019, 7, 15), MerchantName = "CIRCLE_K", Amount = 100m
            };
            var transaction2 = new Transaction {
                Date = new DateTime(2019, 7, 16), MerchantName = "TELIA", Amount = 100m
            };
            var transaction3 = new Transaction {
                Date = new DateTime(2019, 7, 18), MerchantName = "CIRCLE_K", Amount = 100m
            };
            var transaction4 = new Transaction {
                Date = new DateTime(2019, 8, 10), MerchantName = "TELIA", Amount = 100m
            };
            var transaction5 = new Transaction {
                Date = new DateTime(2019, 8, 15), MerchantName = "CIRCLE_K", Amount = 100m
            };
            var transaction6 = new Transaction {
                Date = new DateTime(2019, 8, 16), MerchantName = "TELIA", Amount = 100m
            };

            _sut = new MonthlyCharger(_configMock.Object);
            var result1 = _sut.GetMonthlyFee(transaction1);
            var result2 = _sut.GetMonthlyFee(transaction2);
            var result3 = _sut.GetMonthlyFee(transaction3);
            var result4 = _sut.GetMonthlyFee(transaction4);
            var result5 = _sut.GetMonthlyFee(transaction5);
            var result6 = _sut.GetMonthlyFee(transaction6);

            result1.Should().Be(15);
            result2.Should().Be(15);
            result3.Should().Be(0);
            result4.Should().Be(15);
            result5.Should().Be(15);
            result6.Should().Be(0);
        }
예제 #3
0
        public void GetMonthlyFee_DifferentMerchant_TwoHasFixedFee()
        {
            _configMock.Setup(x => x.Value)
            .Returns(new AppSettings {
                InvoiceFixedFee = 15
            });

            var transaction1 = new Transaction {
                Date = new DateTime(2019, 7, 15), MerchantName = "CIRCLE_K", Amount = 100m
            };
            var transaction2 = new Transaction {
                Date = new DateTime(2019, 7, 16), MerchantName = "TELIA", Amount = 100m
            };

            _sut = new MonthlyCharger(_configMock.Object);
            var result1 = _sut.GetMonthlyFee(transaction1);
            var result2 = _sut.GetMonthlyFee(transaction2);

            result1.Should().Be(15);
            result2.Should().Be(15);
        }
예제 #4
0
 public UserStoryMobilePay5(IMonthlyCharger monthlyCharger)
 {
     _monthlyCharger = monthlyCharger;
 }