Пример #1
0
        public void Should_Return_Zero_If_Initialised_With_Negative_Balance()
        {
            var service = new LevyBalanceService();

            service.Initialise(-50, 0);
            service.TryFund(50).Should().Be(0);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
0
        public void Should_Credit_Transfer_Refunds_To_Levy_Balance()
        {
            var service = new LevyBalanceService();

            service.Initialise(0, 0);
            service.TryFundTransfer(-50).Should().Be(-50);
            service.TryFund(50).Should().Be(50);
        }
Пример #5
0
        public void TestInitialise()
        {
            var service = new LevyBalanceService();

            service.Initialise(100, 50);
            var funded = service.TryFund(50);

            funded.Should().Be(50);
            funded = service.TryFund(100);
            funded.Should().Be(50);
            funded = service.TryFund(1);
            funded.Should().Be(0);
            funded = service.TryFund(-10);
            funded.Should().Be(-10);
            funded = service.TryFund(20);
            funded.Should().Be(10);
        }
Пример #6
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);
        }
Пример #7
0
        public void Should_Throw_If_Tries_To_Use_TryFund_If_Not_Intialised()
        {
            var service = new LevyBalanceService();

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