public void LogFile_DoorUnlocked_CheckIFileWriterCallsRecieved()
        {
            string RFID = "abc1234";

            logFile.DoorUnlocked(RFID);
            fileWriter.Received(1);
        }
Ejemplo n.º 2
0
        public void LogSeparationEvent_CallsFileWriter_PathIsCorrect(string path)
        {
            _uut = new AirTrafficMonitoring.CollisionController.Logger(_fakeCollisionController, path, _fakeFileWriter);

            _fakeCollisionController.SeperationEvent += Raise.EventWith(new SeparationEventArgs(""));

            _fakeFileWriter.Received(1).WriteToFile(path, Arg.Any <string>());
        }
        public void Logging_DoorUnlocked_CorrectIdAndDate(int id)
        {
            DateTime date = new DateTime(2021, 03, 25, 15, 25, 13);

            _tProvider.ProvideDate().Returns(date);
            _uut.LogDoorUnlocked(id);
            _fWriter.Received(1).WriteToFile(Arg.Is <string>(x => x.Contains("Date: " + date + " - Døren er låst op med ID: " + id)));
        }
Ejemplo n.º 4
0
        public void Test_HandleRFIDChangedEvent_WhenAvailableAndChargeControlConnected_RFIDChangedEventRaised_MethodCallCorrect()
        {
            _chargeControl.IsConnected().Returns(true);
            _rfidReader.RFIDChangedEvent += Raise.EventWith(new RFIDChangedEventArgs {
                RFID = 10
            });

            _door.Received().LockDoor();
            _usbCharger.Received().StartCharge();
            _fileWriter.Received().LogDoorLocked(10);
            _display.Received().WriteMessage("Box is taken and locked with RFID: " + 10);
        }
Ejemplo n.º 5
0
        public async Task ExecuteAsync_FileWithSqlStatementOfCreateTableWasCreated()
        {
            // Arrange
            var correctFileName = $"001-create-table-{_transformOptions.TableSchema}_{_transformOptions.TableName}.sql";
            var correctFilePath = Path.Combine(_sourceDirectory, _sourceJsonFileName, correctFileName);
            var correctCreateTableSqlStatement = "create table SQL statement";

            _sqlBuilder.BuildCreateTable().Returns(correctCreateTableSqlStatement);
            // Act
            await _testModule.ExecuteAsync(_transformOptions);

            // Assert
            await _fileWriter.Received(1).WriteAllTextAsync(correctFilePath, correctCreateTableSqlStatement);
        }
        public void HandleFlightsInAirSpace_SeparationEventGetsLogged_EventWasLogged(int altitude1, int altitude2, double x1, double x2, double y1, double y2)
        {
            DateTime timeStamp = DateTime.Now;
            Track    trackOne  = new Track()
            {
                Altitude = altitude1, XCoordinate = x1, YCoordinate = y1, TimeStamp = timeStamp, Tag = "Test1"
            };
            Track trackTwo = new Track()
            {
                Altitude = altitude2, XCoordinate = x2, YCoordinate = y2, TimeStamp = timeStamp, Tag = "Test2"
            };


            List <Track> NewestTracks = new List <Track>();

            NewestTracks.Add(trackOne);
            NewestTracks.Add(trackTwo);

            string expectedNote = "Timestamp: " + timeStamp.ToString() + " Flight: "
                                  + trackOne.Tag + " is on collision with flight: " + trackTwo.Tag;

            _collisionController.HandleFlightsInAirspace(this, new FlightMovementEventArgs(new List <Track>(), NewestTracks));

            _fakeFileWriter.Received(1).WriteToFile("", expectedNote);
        }
        public void PrintPetEntriesCallsFileWriter()
        {
            // Arrange
            var entries = new List <PetEntryModel>();

            // Act
            _target.PrintPetEntries(entries, "petRegistrationDetails.csv");

            // Assert
            _fileWriter.Received().WriteAllLines("petRegistrationDetails.csv", Arg.Any <List <string> >());
        }
Ejemplo n.º 8
0
        public void Debug_Log_Call_Shoould_Write_File_Expected_Message__And_Path()
        {
            string message         = LoggerProvider.CreateLogMessage(MessageLength.Normal);
            string expectedMessage = $"{_dateTimeProviderMock.UtcNow} [DEBUG] {message}";

            _fileLogger.Log(LogLevel.Debug, message);
            _filewriterMock.Received().Write(Arg.Is(expectedFilePath), Arg.Is(expectedMessage));
        }
 public void Then_WriteReport_Is_Called_Exactly_Once()
 {
     _opportunityPipelineReportWriter
     .Received(1)
     .WriteReport(Arg.Any <OpportunityReportDto>());
 }
Ejemplo n.º 10
0
 public void LogMessage_FileWriter()
 {
     _uut.LogMessage("Log to file");
     ifilewriter.Received().WriteLine(Arg.Any <string>());
 }