public void Setup() { _fakeSeparationHandler = Substitute.For <ISeperationHandler>(); _fakeFlightObserver = Substitute.For <IFlightObserver>(); var fakeConsole = Substitute.For <IConsole>(); var fakeLogger = Substitute.For <Infrastructure.ILogger>(); _ssut_view = new ConsoleView(fakeConsole); _sut = new AirspaceEventHandler(_fakeFlightObserver, _ssut_view, fakeLogger, _fakeSeparationHandler); }
public void SetUp() { _fakeTimer = Substitute.For <ITimer>(); _fakeView = Substitute.For <IView>(); _fakeSeperation = Substitute.For <ISeperationHandler>(); var fakeLogger = Substitute.For <ILogger>(); _fakeFlightObserver = Substitute.For <IFlightObserver>(); _uut = new AirspaceEventHandler(_fakeFlightObserver, _fakeView, fakeLogger, _fakeSeperation); }
public AirspaceEventHandler(IFlightObserver flightsInAirspaceSubject, IView view, ILogger logger, ISeperationHandler seperationHandler) { _flightsInAirspaceSubject = flightsInAirspaceSubject; _view = view; _seperationHandler = seperationHandler; _logger = logger; _flightsInAirspaceSubject.EnteredAirspace += EnterAirspaceEvent; _flightsInAirspaceSubject.LeftAirspace += LeftAirspaceEvent; _seperationHandler.FlightsInProximity += DangerOfProximityEvent; }
public void LogOut(Angajat angajat, IFlightObserver observer) { IFlightObserver localClient = loggedAngajati[angajat.Id]; if (localClient == null) { throw new FlightException("Empployee logged out"); } loggedAngajati.Remove(angajat.Id); }
private void notifyAll() { IEnumerable <Angajat> angajati = angajatRepository.FindAll(); foreach (Angajat a in angajati) { if (loggedAngajati.ContainsKey(a.Id)) { IFlightObserver observer = loggedAngajati[a.Id]; observer.TicketBought(zborRepository.findAll()); } } }
private void closeConnection() { finished = true; try { stream.Close(); connection.Close(); _waitHandle.Close(); client = null; } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
public void LogIn(Angajat angajat, IFlightObserver observer) { Angajat angajat1 = angajatRepository.LogIn(angajat.Id, angajat.Password); if (angajat1 != null) { if (loggedAngajati.ContainsKey(angajat.Id)) { throw new FlightException("Employee already logged in!"); } loggedAngajati[angajat.Id] = observer; } else { throw new FlightException("Autthetication failed!"); } }
public void LogOut(Angajat angajat, IFlightObserver observer) { sendRequest(new LogoutRequest(angajat)); Response response = readResponse(); closeConnection(); if (response is ErrorResponse) { ErrorResponse err = (ErrorResponse)response; throw new FlightException(err.Message); } if (response is OkResponse) { this.client = observer; return; } }
public virtual void LogIn(Angajat angajat, IFlightObserver observer) { initializeConnection(); sendRequest(new LoginRequest(angajat)); Response response = readResponse(); if (response is OkResponse) { this.client = observer; return; } if (response is ErrorResponse) { ErrorResponse err = (ErrorResponse)response; closeConnection(); throw new FlightException(err.Message); } }
public void SetUp() { _fakeFlightObserver = Substitute.For <IFlightObserver>(); _uut = new SeparationHandler(); }