public void Setup() { //Arrange _output = Substitute.For <IOutput>(); _filePath = @"...\...\...\"; FileStream output = new FileStream(_filePath + "SeperationLogFile.txt", FileMode.Create, FileAccess.Write); StreamWriter fileWriter = new StreamWriter(output); fileWriter.Write(""); fileWriter.Close(); _transponderReceiver = Substitute.For <ITransponderReceiver>(); _trackTransmitter = new TrackTransmitter(); _dateTimeBuilder = new DateTimeBuilder(); _trackObjectifier = new TrackObjectifier(_dateTimeBuilder); _trackReciever = new TrackReciever(_transponderReceiver, _trackObjectifier, _trackTransmitter); _output = Substitute.For <IOutput>(); _tracksManager = new TracksManager(); _courseCalculator = new CourseCalculator(); _velocityCalculator = new VelocityCalculator(); _seperationEventChecker = new SeperationEventChecker(); _airspace = new Airspace() { MaxAltitude = 20000, MinAltitude = 500, Northeast = new Corner() { X = 90000, Y = 90000 }, Southwest = new Corner() { X = 10000, Y = 10000 } }; _airspaceChecker = new AirspaceChecker(_airspace); _tagsManager = new TagsManager(_airspaceChecker); _trackWarehouse = new TrackWarehouse(_tagsManager, _courseCalculator, _velocityCalculator, _tracksManager, _seperationEventChecker); _atmController = new AtmController(_trackTransmitter, _output, _trackWarehouse); _uut = new SeperationEventLogger(_output, _seperationEventChecker); _list = new List <string> { "ATR423;11000;11000;14000;20151006213456000", "ATR424;11000;11000;14000;20151006213456000" }; _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; }; //Act _transponderReceiver.TransponderDataReady += Raise.EventWith(new RawTransponderDataEventArgs(_list)); }
public void SetUp() { _airspace = new Airspace() { MaxAltitude = 20000, MinAltitude = 500, Northeast = new Corner() { X = 90000, Y = 90000 }, Southwest = new Corner() { X = 10000, Y = 10000 } }; FileStream fs = new FileStream(@"...\...\...\Airspace.xml", FileMode.Create); XmlSerializer serializer = new XmlSerializer(typeof(Airspace)); serializer.Serialize(fs, _airspace); fs.Close(); _transponderReceiver = Substitute.For <ITransponderReceiver>(); _trackTransmitter = new TrackTransmitter(); _dateTimeBuilder = new DateTimeBuilder(); _trackObjectifier = new TrackObjectifier(_dateTimeBuilder); _trackReciever = new TrackReciever(_transponderReceiver, _trackObjectifier, _trackTransmitter); _output = Substitute.For <IOutput>(); _tracksManager = new TracksManager(); _courseCalculator = new CourseCalculator(); _velocityCalculator = new VelocityCalculator(); _seperationEventChecker = new SeperationEventChecker(); _seperationEventLogger = new SeperationEventLogger(_output, _seperationEventChecker); _uut = new AirspaceFileReader(); _airspaceChecker = new AirspaceChecker(_uut.Read()); _tagsManager = new TagsManager(_airspaceChecker); _trackWarehouse = new TrackWarehouse(_tagsManager, _courseCalculator, _velocityCalculator, _tracksManager, _seperationEventChecker); _atmController = new AtmController(_trackTransmitter, _output, _trackWarehouse); _list = new List <string> { "ATR423;11000;11000;14000;20151006213456000" }; _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; }; //Act _transponderReceiver.TransponderDataReady += Raise.EventWith(new RawTransponderDataEventArgs(_list)); }
static void Main(string[] args) { var airspace = new Airspace(); try { AirspaceFileReader airspaceFileReader = new AirspaceFileReader(); airspace = airspaceFileReader.Read(); } catch (Exception e) { Console.WriteLine("Invalid Airspace" + e.ToString()); Console.ReadKey(); } var transponderReceiver = TransponderReceiverFactory.CreateTransponderDataReceiver(); var dateTimeBuilder = new DateTimeBuilder(); var trackObjectifier = new TrackObjectifier(dateTimeBuilder); var trackTransmitter = new TrackTransmitter(); var trackReciever = new TrackReciever(transponderReceiver, trackObjectifier, trackTransmitter); var airspaceChecker = new AirspaceChecker(airspace); var seperationEventChecker = new SeperationEventChecker(); var output = new Output(); var seperationEventLogger = new SeperationEventLogger(output, seperationEventChecker); var courseCalculator = new CourseCalculator(); var velocityCalculator = new VelocityCalculator(); var tracksManager = new TracksManager(); var tagsManager = new TagsManager(airspaceChecker); var trackWarehouse = new TrackWarehouse(tagsManager, courseCalculator, velocityCalculator, tracksManager, seperationEventChecker); var atmController = new AtmController(trackTransmitter, output, trackWarehouse); Console.ReadKey(); }
public void SetUp() { _transponderReceiver = Substitute.For <ITransponderReceiver>(); _trackTransmitter = new TrackTransmitter(); _dateTimeBuilder = new DateTimeBuilder(); _trackObjectifier = new TrackObjectifier(_dateTimeBuilder); _trackReciever = new TrackReciever(_transponderReceiver, _trackObjectifier, _trackTransmitter); _output = Substitute.For <IOutput>(); _tracksManager = new TracksManager(); _airspaceChecker = Substitute.For <IAirspaceChecker>(); _tagsManager = new TagsManager(_airspaceChecker); _courseCalculator = new CourseCalculator(); _velocityCalculator = new VelocityCalculator(); _uut = new SeperationEventChecker(); _seperationEventLogger = Substitute.For <ISeperationEventLogger>(); _trackWarehouse = new TrackWarehouse(_tagsManager, _courseCalculator, _velocityCalculator, _tracksManager, _uut); _atmController = new AtmController(_trackTransmitter, _output, _trackWarehouse); _list = new List <string> { "ATR423;10000;10000;14000;20151006213456000", "ATR424;10000;10100;14000;20151006213456000" }; _trackTransmitter.TrackReady += (o, args) => { _recievedTracks = args.TrackList; }; _uut.SeperationEvent += (o, args) => { _checkedTracks = args.Tracks; }; _airspaceChecker.Check(new Track()).ReturnsForAnyArgs(true); // Act _transponderReceiver.TransponderDataReady += Raise.EventWith(new RawTransponderDataEventArgs(_list)); }
public void SetUp() { _uut = new CourseCalculator(); }