Esempio n. 1
0
        public async Task Handle_NotEnable_ReturnZero()
        {
            _settings.Enabled = false;
            _settings.PointsForPurchases_Amount = 20;
            var command = new CalculateLoyaltyPointsCommand()
            {
                Customer = new Domain.Customers.Customer()
            };
            var result = await _handler.Handle(command, default);

            Assert.AreEqual(0, result);
        }
Esempio n. 2
0
        public async Task Handle_NullCustomer_ReturnZero()
        {
            _settings.Enabled = true;
            _settings.PointsForPurchases_Amount = 20;
            var command = new CalculateLoyaltyPointsCommand()
            {
                Customer = null
            };
            var result = await _handler.Handle(command, default);

            Assert.AreEqual(decimal.Zero, result);
        }
Esempio n. 3
0
        public async Task Handle_ReturnExpectedValue()
        {
            _settings.Enabled = true;
            _settings.PointsForPurchases_Amount = 10;
            _settings.PointsForPurchases_Points = 2;
            var command = new CalculateLoyaltyPointsCommand()
            {
                Customer = new Domain.Customers.Customer(),
                Amount   = 100
            };

            Assert.AreEqual(20, await _handler.Handle(command, default));
            command.Amount = 200;
            Assert.AreEqual(40, await _handler.Handle(command, default));
            command.Amount = 375;
            Assert.AreEqual(75, await _handler.Handle(command, default));
        }