Exemple #1
0
        public void ShouldOpenFileAndReadStream()
        {
            var mockstream = new Mock <Stream>();

            mockstream.Setup(x => x.CanRead).Returns(true);
            var streamreader = new StreamReader(mockstream.Object);

            _csvWriter.Open(Filename);

            var stream = _csvWriter.GetWriter();

            Assert.That(stream, Is.EqualTo(streamreader));

            _csvWriter.Close();
        }
Exemple #2
0
 public void Close()
 {
     _csvWriter?.Close();
     _csvWriter = null;
     _csvReader?.Close();
     _csvReader = null;
 }
Exemple #3
0
        public void Close()
        {
            IsWriterInitialized();
            IsReaderInitialized();

            _writer.Close();
            _reader.Close();
        }
Exemple #4
0
 public void Close()
 {
     if (contactsReader != null)
     {
         contactsReader.Close();
     }
     if (csvWriter != null)
     {
         csvWriter.Close();
     }
 }
Exemple #5
0
        /*************************************************************************************************/
        public void UpdateUsersCSVFile(string filename, List <User> encryptedUsers)
        {
            if (encryptedUsers == null)
            {
                throw new ArgumentNullException(nameof(encryptedUsers));
            }

            _writer.Initialize(filename);

            foreach (var user in encryptedUsers)
            {
                _writer.WriteLine(user.GetUserString());
            }

            _writer.Close();
        }
        /*************************************************************************************************/
        public void UpdatePasswordCSVFile(string filename, List <DatabasePassword> encryptedPasswords)
        {
            if (encryptedPasswords == null)
            {
                throw new ArgumentNullException(nameof(encryptedPasswords));
            }

            _writer.Initialize(filename);

            foreach (var password in encryptedPasswords)
            {
                _writer.WriteLine(password.GetPasswordString());
            }

            _writer.Close();
        }
Exemple #7
0
 public void Close()
 {
     _csvReader.Close();
     _csvWriter.Close();
 }