Пример #1
0
    public void DeleteWithBackupTest()
    {
      var file = GetCsvFile();
      FileSystemUtils.DeleteWithBackup(fileName, false);
      Assert.IsFalse(FileSystemUtils.FileExists(fileName));
      Assert.IsFalse(FileSystemUtils.FileExists(fileName + ".bak"));

      SerializedFilesLib.SaveCsvFile(fileName, file);
      Assert.IsTrue(FileSystemUtils.FileExists(fileName));
      FileSystemUtils.DeleteWithBackup(fileName, false);
      Assert.IsFalse(FileSystemUtils.FileExists(fileName));
      Assert.IsTrue(FileSystemUtils.FileExists(fileName + ".bak"));
    }
Пример #2
0
    public void SaveCsvFileTest()
    {
      var file = GetCsvFile();
      Assert.IsFalse(FileSystemUtils.FileExists(fileName));
      SerializedFilesLib.SaveCsvFile(fileName, file);
      Assert.IsTrue(FileSystemUtils.FileExists(fileName));
      var test = SerializedFilesLib.LoadCsvFile(fileName);

      Assert.AreNotSame(file, test);
      Assert.IsInstanceOfType(test, typeof(CsvFile));

      file.AllPropertiesEqual(test);
      // Test Properties that are not tested

      Assert.AreEqual(file.Mapping.Count, test.Mapping.Count, "FieldMapping");
      Assert.AreEqual(TrimmingOption.Unquoted, test.TrimmingOption, "TrimmingOption");
      Assert.IsTrue(file.Mapping.CollectionEqual(test.Mapping), "Mapping");
      Assert.IsTrue(file.FileFormat.Equals(test.FileFormat), "FileFormat");
    }