public void EPFArchive_ValidInputStream_CreatesEmptyArchive_Test() { //Arrange //Act var epfArchive = EPFArchive.ToCreate(); var entriesNo = epfArchive.Entries.Count; //Assert Assert.IsTrue(entriesNo == 0, "Created EPF Archive should not contain any entries."); }
public void CreateEntry_CreatesNewEntry_Test() { //Arrange var epfArchive = EPFArchive.ToCreate(); //Act epfArchive.CreateEntry("TFile1.txt", $@"{EXPECTED_EXTRACT_DIR}\TFile1.txt"); var entriesNo = epfArchive.Entries.Count; //Assert Assert.IsTrue(entriesNo == 1, "Created EPF Archive should contain one entry."); }
public void Save_ChangesModeToUpdate_Throws_Test() { //Arrange var epfArchive = EPFArchive.ToCreate(); epfArchive.CreateEntry("TFile1.txt", $@"{EXPECTED_EXTRACT_DIR}\TFile1.txt"); var entriesNo = epfArchive.Entries.Count; //Act epfArchive.Save(); //Assert }
public void SaveAs_InvalidStream_Throws_Test() { //Arrange var epfArchive = EPFArchive.ToCreate(); epfArchive.CreateEntry("TFile1.txt", $@"{EXPECTED_EXTRACT_DIR}\TFile1.txt"); var entriesNo = epfArchive.Entries.Count; //Act epfArchive.SaveAs(_readonlyEPFFileStream); //Assert }
public void SaveAs_ValidStream_IsModifiedChanged_Test() { //Arrange var epfArchive = EPFArchive.ToCreate(); epfArchive.CreateEntry("TFile1.txt", $@"{EXPECTED_EXTRACT_DIR}\TFile1.txt"); var entriesNo = epfArchive.Entries.Count; //Act var oldValue = epfArchive.IsModified; epfArchive.SaveAs(_newEPFFileStream); var newValue = epfArchive.IsModified; //Assert Assert.IsTrue(oldValue == true && newValue == false, "Saving created archive should change IsModified propery from true to false."); }
private void CreateArchive() { try { _epfArchive = EPFArchive.ToCreate(); _epfArchive.EntryChanged += _epfArchive_EntryChanged; _epfArchive.PropertyChanged += _epfArchive_PropertyChanged; dispatcher.Invoke(RefreshEntries); ArchiveFilePath = null; AppLabel = $"{APP_NAME} - New archive"; IsReadOnly = false; IsArchiveOpened = true; IsArchiveModified = true; IsArchiveSaveAllowed = true; Status.Log.Success($"New archive created."); } catch (Exception ex) { Status.Log.Error($"Unable to create archive. Reason: {ex.Message}"); } }