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 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); }
public CallChargesStatistics(CallChargesBill bill) { Check.Argument.IsNotNull(bill, nameof(bill)); this.bill = bill; }