public void DeleteLeaf_WorksAsExpected()
        {
            ResetHandlers();

            // Arrange - Get tree path.
            var treePath = _baseDirectory + _testingTreeName;

            // Act - Create tree.
            _folderLogicHandler.CreateNewTreeFolder(treePath);

            // Act - Add in leaf (generic file, not actually being created from the internal methods).
            var leafPath      = _folderLogicHandler.GetFullLeafPath(_testingTreeName, _testingLeafName);
            var mockInputFile = new MockFileData("line1\nline2\nline3");

            _mockFileSystem.AddFile(leafPath, mockInputFile);

            // Assert - Check that leaf was created as expected.
            Assert.True(_mockFileSystem.File.Exists(leafPath));
            Assert.True(_mockFileSystem.Path.GetFileNameWithoutExtension(leafPath) == $"{_testingLeafName}");

            // Act - Delete leaf.
            _folderLogicHandler.DeleteLeaf(leafPath);

            // Assert - Check that leaf was deleted.
            Assert.True(_mockFileSystem.File.Exists(leafPath) == false);
        }
Exemple #2
0
        public void CreateTestLeaf()
        {
            // Get test tree directory.
            _fullTreePath = _folderLogicHandler.GetFullTreePath(_testingTreeName);
            Directory.CreateDirectory(_fullTreePath);

            // Create tree.
            _fullLeafPath = _folderLogicHandler.GetFullLeafPath(_testingTreeName, _testingLeafName);
            _wordLogicHandler.CreateNewLeaf(_fullLeafPath, _testingLeafName, _testingTreeName);
        }