Exemplo n.º 1
0
        public async Task ShouldBeAbleToAddAndRoundTripANewFixedCommission()
        {
            var fixedCommissionAmount = new FixedCommissionAmount("OM19-001", 15.00M);

            await this.Subject.SaveFixedCommissionAsync(fixedCommissionAmount);

            var newFixedCommissionAmount = await this.Subject.GetFixedCommissionAsync("OM19-001");

            newFixedCommissionAmount.Should().BeEquivalentTo(fixedCommissionAmount);
        }
Exemplo n.º 2
0
            public async Task ShouldIncludeTheFixedCommissionAmountsAsATransaction()
            {
                var product         = TestData.Create <Product>();
                var fixedCommission = new FixedCommissionAmount(product.ProductCode, 1.00m);

                this.GivenInventoryServiceSetUpWithProduct(product);
                this.GivenFixedCommissionAmountExists(product, fixedCommission);
                var order        = this.GivenOrderProductAsLineItem(product);
                var transactions = await this.Subject.MapToTransaction(order).ToList().ToTask();

                transactions.Should().HaveCount(1);
                transactions[0].TotalAmount.Should().Be(10.00m);
                transactions[0].Subtransactions.Should().HaveCount(2);
                transactions[0].Subtransactions[0].Product.Should().Be(product);
                transactions[0].Subtransactions[0].Quantity.Should().Be(2);
                transactions[0].Subtransactions[0].TransactionUnitPrice.Should().Be(4.00m);
                transactions[0].Subtransactions[0].Subtotal.Should().Be(8.00m);
                transactions[0].Subtransactions[1].Product.ProductCode.Should().StartWith("TLM");
                transactions[0].Subtransactions[1].Quantity.Should().Be(2);
                transactions[0].Subtransactions[1].TransactionUnitPrice.Should().Be(1.00m);
                transactions[0].Subtransactions[1].Subtotal.Should().Be(2.00m);
            }
Exemplo n.º 3
0
 /// <inheritdoc />
 public Task SaveFixedCommissionAsync(FixedCommissionAmount commission)
 {
     this.logger.LogInformation("Saving fixed commission amount for '{ProductCode}': {@Commission}", commission.ProductCode, commission);
     return(this.fixedCommissionAmountRepository.SaveAsync(commission));
 }
Exemplo n.º 4
0
 private void GivenFixedCommissionAmountExists(Product product, FixedCommissionAmount fixedCommissionAmount)
 {
     this.fixedCommissionAmountService.Setup(x => x.GetFixedCommissionAsync(product.ProductCode)).ReturnsAsync(fixedCommissionAmount);
 }