Exemple #1
0
        public async void CalculateTrolley_WhenTrolleyInfoIsNull_ReturnsZero()
        {
            // Arrange
            var sutTrolleyCalculator = new TrolleyCalculator2();

            // Act
            var result = await sutTrolleyCalculator.CalculateTrolley(null);

            // Assert
            result.Should().Be(0);
        }
Exemple #2
0
        public async void CalculateTrolley_WhenTrolleyInfoIsValid_ReturnsCorrectMinimumTotal(TrolleyInfo trolleyInfo, decimal expectedTotal)
        {
            // Arrange
            var sutTrolleyCalculator = new TrolleyCalculator2();

            // Act
            var result = await sutTrolleyCalculator.CalculateTrolley(trolleyInfo);

            // Assert
            result.Should().Be(expectedTotal);
        }
Exemple #3
0
        public void CalculateTrolley_WhenTrolleyInfoPropertyIsNull_ThrowArgumentException(TrolleyInfo trolleyInfo)
        {
            // Arrange
            var sutTrolleyCalculator = new TrolleyCalculator2();

            // Act
            Func <Task> action = async() => await sutTrolleyCalculator.CalculateTrolley(trolleyInfo);

            // Assert
            action.Should().ThrowExactlyAsync <ArgumentException>()
            .WithMessage("Products, Quantities and Specials properties cannot be null.");
        }