public PhoneOperator(int dayInterval = 100000) { dtHelper = new DateTimeHelper(dayInterval); IPortFactory pFactory = new PePortFactory(); ape = new PhoneExchange(pFactory, (new IntId()).StartValue()); Billing = new Billing(ape, new ContractFactory(dtHelper), new SubscriberFactory(), dtHelper); }
public Billing(IBillableExchange phoneExchange, IContractFactory contractFactory, ISubscriberFactory subscriberFactory, IDateTimeHelper dtHelper = null) { if (phoneExchange == null) { throw new ArgumentNullException("phoneExchange", "phoneExchange cannot be null."); } _dtHelper = dtHelper ?? new DefaultDateTimeHelper(); _dtHelper.DayIntervalChanged += BillingDayIntervalChanged; _phoneExchange = phoneExchange; _contractFactory = contractFactory; _subscriberFactory = subscriberFactory; _phoneExchange.CallLog += BillingCallLog; _phoneExchange.CallPermissionCheck += BillingCallPermissionCheck; _timer = new Timer(_dtHelper.DayInterval); _timer.AutoReset = true; _timer.Elapsed += DailyTask; _timer.Start(); }