Exemplo n.º 1
0
        public void CheckIfSeperationEventExistsFor_TrackLeftEventExists_ReturnFalse()
        {
            TrackLeftEvent tle = new TrackLeftEvent(timeStamp, td1, true, fakeConsoleOutput, fakeFileOutput);

            uut.events.Add(tle);
            Assert.That(uut.CheckIfSeperationEventExistsFor(td1, td2).Equals(false));
        }
Exemplo n.º 2
0
        public void CheckIfTrackLeftEventExistsFor_InvolvingTrackLeftEventExists_ReturnTrue()
        {
            TrackLeftEvent tle = new TrackLeftEvent(timeStamp, td1, true, fakeConsoleOutput, fakeFileOutput);

            uut.events.Add(tle);
            Assert.That(uut.checkIfTrackLeftEventExistsFor(td1).Equals(true));
        }
Exemplo n.º 3
0
        public void AddTrackLeftEventFor(TrackData td, IFileOutput logger)
        {
            TrackLeftEvent tle = new TrackLeftEvent(td.TimeStamp, td, true, td.ConsoleOutput, logger);

            events.Add(tle);
            logger.Write(tle.FormatData());
        }
Exemplo n.º 4
0
        public void Intervaltimer_trackleftevent()
        {
            TrackData trackData1 = new TrackData("TEST1", 12000, 12000, 1000, "14322018", 10, 270, consoleOutput);

            string time = trackData1.TimeStamp;

            TrackLeftEvent TrackLeftEvent = new TrackLeftEvent(time, trackData1, true, consoleOutput, fileOutput);

            //Wait 6 seconds to check if isRaised flag has been set to False by the IntervalTimers Start and TimerElapsed function
            Thread.Sleep(6000);

            //Check if isRaised flag has been set to False
            Assert.That(() => TrackLeftEvent.isRaised.Equals(false));
        }
Exemplo n.º 5
0
        public void RenderEvents_TrackLeftEventInList_CorrectStringPrinted()
        {
            TrackLeftEvent se1 = new TrackLeftEvent(timeStamp, td1, false, fakeConsoleOutput, fakeFileOutput);

            uut.events.Add(se1);

            string expectedString = se1.FormatData();

            //Console output did not receive anything before rendering
            fakeConsoleOutput.DidNotReceiveWithAnyArgs().Print("Any string");

            uut.RenderEvents();

            //Console output received the expected string
            fakeConsoleOutput.Received().Print(Arg.Is <string>(str => str.Contains(expectedString)));
        }
        public void setup()
        {
            fakeFileOutput    = Substitute.For <IFileOutput>();
            fakeConsoleOutput = Substitute.For <IConsoleOutput>();
            timeStamp         = "235928121999";
            td1 = new TrackData("ABC123", 10000, 10000, 1000, timeStamp, 100, 45, fakeConsoleOutput);
            td2 = new TrackData("DEF123", 10000, 10000, 1000, timeStamp, 100, 45, fakeConsoleOutput);
            td3 = new TrackData("XYZ123", 10000, 10000, 1000, timeStamp, 100, 45, fakeConsoleOutput);

            List <TrackData> tracks = new List <TrackData>()
            {
                td1,
                td2
            };

            uut_se  = new SeperationEvent(timeStamp, tracks, true, fakeConsoleOutput, fakeFileOutput);
            uut_tee = new TrackEnteredEvent(timeStamp, td1, true, fakeConsoleOutput, fakeFileOutput);
            uut_tle = new TrackLeftEvent(timeStamp, td1, true, fakeConsoleOutput, fakeFileOutput);
        }
Exemplo n.º 7
0
        public void setup()
        {
            //Set up S's
            fakeConsoleOutput = Substitute.For<IConsoleOutput>();
            fakeFileOutput = Substitute.For<IFileOutput>();

            //Set up T's
            trackData1 = new TrackData("ABC123",10000,10000,1000,"201811071337000",42,10,fakeConsoleOutput);
            trackData1 = new TrackData("XYZ987", 10001, 10001, 1001, "201811071338000", 42, 10, fakeConsoleOutput);
            tracks = new List<TrackData>()
            {
                trackData1,
                trackData2
            };
            seperationEvent = new SeperationEvent("201811071337000",tracks,true, fakeConsoleOutput,fakeFileOutput);
            trackEnteredEvent = new TrackEnteredEvent(trackData1._TimeStamp,trackData1,true, fakeConsoleOutput, fakeFileOutput);
            trackLeftEvent = new TrackLeftEvent(trackData1._TimeStamp,trackData1,true, fakeConsoleOutput, fakeFileOutput);

            //Set up X's
        }
Exemplo n.º 8
0
        public void RenderEvents_ThreeEventsDifferentTypesInList_PrintCalledThreeTimes()
        {
            //Test is done with seperation events, since the _isRaised-attribute of
            //TrackEnteredEvent and TrackLeftEvent goes false after a set amount of time, introducing possible errors
            List <TrackData> tracks = new List <TrackData>();

            tracks.Add(td1);
            tracks.Add(td2);
            SeperationEvent   se1  = new SeperationEvent(timeStamp, tracks, false, fakeConsoleOutput, fakeFileOutput);
            TrackEnteredEvent tee1 = new TrackEnteredEvent(timeStamp, td1, true, fakeConsoleOutput, fakeFileOutput);
            TrackLeftEvent    tle1 = new TrackLeftEvent(timeStamp, td1, true, fakeConsoleOutput, fakeFileOutput);

            uut.events.Add(se1);
            uut.events.Add(tee1);
            uut.events.Add(tle1);

            uut.RenderEvents();

            //Check that Print was called only once
            fakeConsoleOutput.ReceivedWithAnyArgs(3).Print("Any string");
        }