示例#1
0
        public void CalculateFee_WhenInputIsCorrect_ShouldReturnCorrectValue(float rate, float transactionAmount, float expectedFee)
        {
            // Arrange
            var transaction = new Transaction("X", DateTime.Now, (decimal)transactionAmount);
            var fee         = new PercentageFee((decimal)rate);

            // Act
            var result = fee.CalculateFee(transaction);

            // Assert
            Assert.NotNull(result);
            Assert.Equal((decimal)expectedFee, result.Amount);
        }
示例#2
0
        public void CalculateFee_ShouldCopyMerchantNameAndDateToFee()
        {
            // Arrange
            var transaction = new Transaction("X", DateTime.Now, 100M);
            var fee         = new PercentageFee(0.5M);

            // Act
            var result = fee.CalculateFee(transaction);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(transaction.MerchantName, result.MerchantName, StringComparer.Ordinal);
            Assert.Equal(transaction.Date, result.Date);
        }