public Terminal(Phone phoneNumber, ITelephoneExchange exchange, IUssdRunner ussdRunner, TimeSpan callReceivingDelay) { this.PhoneNumber = phoneNumber; this._telephoneExchange = exchange; this._ussdRunner = ussdRunner; this._callReceivingDelayMs = (int)callReceivingDelay.TotalMilliseconds; this._callReceivingDelayCancellator = new CancellationTokenSource(); }
public void Init() { var phoneNumbers = new int[] { 111, 222, 333 }; _phones = phoneNumbers.Select(numb => new Phone(numb)).ToList(); var portNumbers = new List <int>() { 10, 20, 30 }; var ports = portNumbers.Select(numb => new Port(numb)); var exchangeBiling = new Mocks.ExchangeBillingMock(p => true); _exchange = new ATS.TelephoneExchange(new HashSet <IPort>(ports), new HashSet <Phone>(_phones), exchangeBiling); }
public void Init() { var phoneNumbers = new int[] { 100, 333 }; _phones = phoneNumbers.Select(numb => new Phone(numb)).ToList(); var portNumbers = new List <int>() { 10, 20 }; var ports = portNumbers.Select(numb => new Port(numb)); Func <Phone, bool> blockOddNumbersStrategy = (Phone p) => int.Parse($"{p}") % 2 == 0; var exchangeBilling = new Mocks.ExchangeBillingMock(blockOddNumbersStrategy); _exchange = new ATS.TelephoneExchange(new HashSet <IPort>(ports), new HashSet <Phone>(_phones), exchangeBilling); }