Exemple #1
0
        public void CallTest(Terminal terminal1, Terminal terminal2)
        {
            var ports = new List <Port>()
            {
                new Port(), new Port()
            };

            terminal1.Plug(ports[0]);
            terminal2.Plug(ports[1]);
            var subscribers = new List <BillingSubscriber>()
            {
                new BillingSubscriber(terminal1.Number), new BillingSubscriber(terminal2.Number)
            };
            var billingStation = new BillingStation(subscribers);
            var station        = new Station(ports, billingStation);

            station.NewRequestWaiting(ports[0]);
            station.NewRequestWaiting(ports[1]);
            terminal1.Call(terminal2.Number);
            terminal2.Port.IncomingRequest += ((sender, request) => Assert.Equal(request.Source, terminal1.Number));
            terminal2.Answer();
            terminal1.Port.StationRespond += ((sender, respond) => Assert.Equal(respond.AcceptMessage, "Call Started"));
            Thread.Sleep(1000);
            terminal1.EndCall();
            terminal2.Port.CallEnd += ((sender, args) => Assert.Equal(sender, terminal1));
            var stats = subscribers[0].GetStats();

            foreach (var callInfo in stats)
            {
                Assert.Equal(callInfo.Source, terminal1.Number);
                Assert.Equal(callInfo.Target, terminal2.Number);
                Assert.NotNull(callInfo.Started);
                Assert.NotNull(callInfo.Ended);
            }
        }
Exemple #2
0
 public StationConsole(List <Terminal> terminals, List <Port> ports, List <BillingSubscriber> billingSubscribers, BillingStation billingStation, Station station)
 {
     _terminals          = terminals;
     _ports              = ports;
     _billingSubscribers = billingSubscribers;
     _billingStation     = billingStation;
     _station            = station;
 }
Exemple #3
0
 public StationConsole()
 {
     _terminals          = new List <Terminal>();
     _ports              = new List <Port>();
     _billingSubscribers = new List <BillingSubscriber>();
     _billingStation     = new BillingStation(_billingSubscribers);
     _station            = new Station(_ports, _billingStation);
     ContractManager     = new StationContractManager(_terminals, _ports, _billingSubscribers);
 }
Exemple #4
0
 public Station(List <Port> portCollection, BillingStation billingStation)
 {
     _portCollection = portCollection;
     _billingStation = billingStation;
 }