示例#1
0
        public void Should_Credit_Transfer_Refunds_To_Transfer_Allowance()
        {
            var service = new LevyBalanceService();

            service.Initialise(75, 0);
            service.TryFundTransfer(-50).Should().Be(-50);
            service.TryFundTransfer(50).Should().Be(50);
        }
示例#2
0
        public void Should_Not_Allow_Transfer_Funding_If_Enough_Levy_But_No_Remaining_Allowance()
        {
            var service = new LevyBalanceService();

            service.Initialise(75, 50);
            service.TryFundTransfer(50).Should().Be(50);
            service.TryFundTransfer(25).Should().Be(0);
        }
示例#3
0
        public void Should_Not_Allow_Levy_Funding_If_All_Levy_Spent_On_Transfers()
        {
            var service = new LevyBalanceService();

            service.Initialise(75, 75);
            service.TryFundTransfer(50).Should().Be(50);
            service.TryFundTransfer(25).Should().Be(25);
            service.TryFund(25).Should().Be(0);
        }
示例#4
0
        public void Should_Return_Transfer_Refund_Amount()
        {
            var service = new LevyBalanceService();

            service.Initialise(75, 0);
            service.TryFundTransfer(-50).Should().Be(-50);
        }
示例#5
0
        public void Should_Allow_Partial_Transfer_Funding_If_Not_Enough_Levy_To_Cover_Whole_Amount()
        {
            var service = new LevyBalanceService();

            service.Initialise(50, 75);
            service.TryFundTransfer(75).Should().Be(50);
        }
示例#6
0
        public void Should_Allow_Transfer_Payments_If_Enough_Allowance_And_Levy()
        {
            var service = new LevyBalanceService();

            service.Initialise(100, 50);
            service.TryFundTransfer(50).Should().Be(50);
        }
示例#7
0
        public void Should_Return_Zero_If_Initialised_With_Negative_Transfer_Balance()
        {
            var service = new LevyBalanceService();

            service.Initialise(50, -50);
            service.TryFundTransfer(50).Should().Be(0);
        }
示例#8
0
        public void Should_Allow_Levy_Funding_After_Transfer_Funds_Have_Been_Spent()
        {
            var service = new LevyBalanceService();

            service.Initialise(75, 50);
            service.TryFundTransfer(50).Should().Be(50);
            service.TryFund(25).Should().Be(25);
        }
示例#9
0
        public void Should_Debit_Transfer_Allowance_When_Levy_Balance_Is_Under_Allowance()
        {
            var service = new LevyBalanceService();

            service.Initialise(50, 50);
            service.TryFund(50).Should().Be(50);
            service.TryFundTransfer(50).Should().Be(0);
        }
示例#10
0
        public void Should_Throw_If_Tries_To_Use_TryFundTransfer_If_Not_Intialised()
        {
            var service = new LevyBalanceService();

            Assert.Throws <InvalidOperationException>(() => service.TryFundTransfer(50));
        }