Example #1
0
        public async Task InvoiceProperties_Must_Contain_The_CumulativeAccounts()
        {
            _invoiceBuilder
            .SetAmount(10)
            .AddMellatCumulativeAccount(1, 4, 10)
            .AddMellatCumulativeAccount(2, 6)
            .UseMellat();

            var invoice = await _invoiceBuilder.BuildAsync();

            Assert.IsNotNull(invoice);
            Assert.IsNotNull(invoice.Properties);
            Assert.AreEqual(1, invoice.Properties.Count);
            Assert.IsTrue(invoice.Properties.ContainsKey(MellatHelper.CumulativeAccountsKey));
            var cumulativeAccounts = invoice.Properties[MellatHelper.CumulativeAccountsKey] as List <MellatCumulativeDynamicAccount>;

            Assert.IsNotNull(cumulativeAccounts);
            Assert.AreEqual(2, cumulativeAccounts.Count);

            Assert.AreEqual(1, cumulativeAccounts[0].SubServiceId);
            Assert.AreEqual(4, cumulativeAccounts[0].Amount.Value);
            Assert.AreEqual(10, cumulativeAccounts[0].PayerId);

            Assert.AreEqual(2, cumulativeAccounts[1].SubServiceId);
            Assert.AreEqual(6, cumulativeAccounts[1].Amount.Value);
            Assert.AreEqual(0, cumulativeAccounts[1].PayerId);
        }
Example #2
0
        public async Task Invoice_Must_Have_The_Expected_Amount()
        {
            const decimal expectedValue = 1000;

            _builder.SetAmount(expectedValue);

            var invoice = await _builder.BuildAsync();

            Assert.AreEqual(expectedValue, (decimal)invoice.Amount);
        }
 /// <summary>
 /// Sets amount of the invoice.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="amount">The amount of invoice.</param>
 public static IInvoiceBuilder SetAmount(this IInvoiceBuilder builder, decimal amount)
 {
     return(builder.SetAmount(amount));
 }