示例#1
0
文件: Bill.cs 项目: jasatwal/skybill
        public Bill(Statement statement,
                    PackageBill package,
                    CallChargesBill callCharges,
                    SkyStoreBill skyStore,
                    Money total)
        {
            Check.Argument.IsNotNull(statement, nameof(statement));
            Check.Argument.IsNotNull(package, nameof(package));

            this.statement = statement;
            this.package = package;
            this.callCharges = callCharges;
            this.skyStore = skyStore;

            costings = new BillCostings(
                package.Costings.Total
                    .Add(callCharges?.Costings.Total ?? Money.Zero)
                    .Add(skyStore?.Costings.Total ?? Money.Zero),
                total);
        }
示例#2
0
文件: Bill.cs 项目: jasatwal/skybill
        public Bill(Statement statement,
                    PackageBill package,
                    CallChargesBill callCharges,
                    SkyStoreBill skyStore,
                    Money total)
        {
            Check.Argument.IsNotNull(statement, nameof(statement));
            Check.Argument.IsNotNull(package, nameof(package));

            this.statement   = statement;
            this.package     = package;
            this.callCharges = callCharges;
            this.skyStore    = skyStore;

            costings = new BillCostings(
                package.Costings.Total
                .Add(callCharges?.Costings.Total ?? Money.Zero)
                .Add(skyStore?.Costings.Total ?? Money.Zero),
                total);
        }
        public void GetChargesValueTest()
        {
            // Arrange
            var rentals = new[]
            {
                new SkyStorePurchase(new SkyStoreMovie("50 Shades of Grey"), new Money(4.99M))
            };
            var buyAndKeep = new[]
            {
                new SkyStorePurchase(new SkyStoreMovie("That's what she said"), new Money(9.99M)),
                new SkyStorePurchase(new SkyStoreMovie("Broke back mountain"), new Money(9.99M))
            };
            var bill  = new SkyStoreBill(rentals, buyAndKeep, new Money(24.97M));
            var stats = new SkyStoreStatistics(bill);

            // Act
            var results = stats.GetChargesValue();

            // Assert
            Assert.AreEqual(2, results.Count());
            Assert.AreEqual(rentals.Sum(), results.ElementAt(0).Value);
            Assert.AreEqual(buyAndKeep.Sum(), results.ElementAt(1).Value);
        }
示例#4
0
        public SkyStoreStatistics(SkyStoreBill bill)
        {
            Check.Argument.IsNotNull(bill, nameof(bill));

            this.bill = bill;
        }
示例#5
0
        public SkyStoreStatistics(SkyStoreBill bill)
        {
            Check.Argument.IsNotNull(bill, nameof(bill));

            this.bill = bill;
        }