示例#1
0
        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.");
        }
示例#2
0
        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.");
        }
示例#3
0
        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
        }
示例#4
0
        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
        }
示例#5
0
        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.");
        }
示例#6
0
        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}");
            }
        }