コード例 #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);
        }
コード例 #3
0
        public void GetCalledFrequencyTest()
        {
            // Arrange
            var charges = new[]
            {
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(19), new Money(.19M)),
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(58), new Money(.58M)),
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(105), new Money(.05M)),
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(44), new Money(.44M)),
                new CallCharge(new TelephoneNumber("0781552266"), TimeSpan.FromSeconds(44), new Money(.44M))
            };
            var bill  = new CallChargesBill(charges, charges.Sum());
            var stats = new CallChargesStatistics(bill);

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

            // Assert
            Assert.AreEqual(2, results.Count());
            Assert.AreEqual(new TelephoneNumber("0123456789"), results.ElementAt(0).Number);
            Assert.AreEqual(new TelephoneNumber("0781552266"), results.ElementAt(1).Number);
            Assert.AreEqual(4, results.ElementAt(0).Frequency);
            Assert.AreEqual(1, results.ElementAt(1).Frequency);
        }
コード例 #4
0
        public void GetCalledFrequencyTest()
        {
            // Arrange
            var charges = new[]
            {
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(19), new Money(.19M)),
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(58), new Money(.58M)),
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(105), new Money(.05M)),
                new CallCharge(new TelephoneNumber("0123456789"), TimeSpan.FromSeconds(44), new Money(.44M)),
                new CallCharge(new TelephoneNumber("0781552266"), TimeSpan.FromSeconds(44), new Money(.44M))
            };
            var bill = new CallChargesBill(charges, charges.Sum());
            var stats = new CallChargesStatistics(bill);

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

            // Assert
            Assert.AreEqual(2, results.Count());
            Assert.AreEqual(new TelephoneNumber("0123456789"), results.ElementAt(0).Number);
            Assert.AreEqual(new TelephoneNumber("0781552266"), results.ElementAt(1).Number);
            Assert.AreEqual(4, results.ElementAt(0).Frequency);
            Assert.AreEqual(1, results.ElementAt(1).Frequency);
        }
コード例 #5
0
        public CallChargesStatistics(CallChargesBill bill)
        {
            Check.Argument.IsNotNull(bill, nameof(bill));

            this.bill = bill;
        }
コード例 #6
0
        public CallChargesStatistics(CallChargesBill bill)
        {
            Check.Argument.IsNotNull(bill, nameof(bill));

            this.bill = bill;
        }