Ejemplo n.º 1
0
        public TextFile(string fileName, Folder folder, string content)
            : base(fileName, folder)
        {
            if (content == null) throw new ArgumentNullException("content");

            this.mContent = content;
        }
Ejemplo n.º 2
0
        public Folder(string folderName, Folder parentFolder)
        {
            if (folderName.IsNullOrWhiteSpace()) throw new ArgumentNullException("folderName");

            this.folderName = folderName;
            this.parentFolder = parentFolder;
        }
Ejemplo n.º 3
0
        public FeatureFile(string fileName, Folder folder, Feature feature, IFileSystem fileSystem)
            : base(fileName, folder, fileSystem)
        {
            if (feature == null) throw new ArgumentNullException("feature");

            this.mContent = feature;
        }
Ejemplo n.º 4
0
        public void FindCommonAncestor_NullArgument_ThrowsArgumentNullException()
        {
            var folder = new Folder("Folder Name");

            var exception = Assert.Throws<ArgumentNullException>(() => folder.FindCommonAncestor(null));

            exception.ParamName.ShouldEqual("other");
        }
Ejemplo n.º 5
0
        public void Constructor_WithParentFolder_SetsParentFolderProperty()
        {
            var parentFolder = new Folder("Parent Folder Name");

            var folder = new Folder("Folder Name", parentFolder);

            folder.ParentFolder.ShouldEqual(parentFolder);
        }
Ejemplo n.º 6
0
        public void FindCommonAncestor_ItsOwnParent_ReturnsParent()
        {
            var parentFolder = new Folder("Parent Folder Name");

            var folder = new Folder("Folder Name", parentFolder);

            ITreeItem commonAncestor = folder.FindCommonAncestor(parentFolder);

            commonAncestor.ShouldEqual(parentFolder);
        }
Ejemplo n.º 7
0
        public void FindCommonAncestor_TwoSiblings_ReturnsParent()
        {
            var parentFolder = new Folder("Parent Folder Name");

            var sibling1 = new Folder("Sibling 1", parentFolder);
            var sibling2 = new Folder("Sibling 2", parentFolder);

            ITreeItem commonAncestor = sibling1.FindCommonAncestor(sibling2);

            commonAncestor.ShouldEqual(parentFolder);
        }
Ejemplo n.º 8
0
        protected FileBase(string fileName, Folder folder)
        {
            if (fileName.IsNullOrWhiteSpace()) throw new ArgumentNullException("fileName");

            string name = Path.GetFileNameWithoutExtension(fileName);

            if (name.IsNullOrWhiteSpace())
                throw new ArgumentException("Filename must consist of more than only the extension.", "fileName");

            this.mName = name;

            if (folder == null) throw new ArgumentNullException("folder");

            this.mFolder = folder;
        }
Ejemplo n.º 9
0
 public TestableFileBase(string fileName, Folder folder)
     : base(fileName, folder)
 {
 }
Ejemplo n.º 10
0
 public TestableFileBase(string fileName, Folder folder, IFileSystem filesSystem)
     : base(fileName, folder, filesSystem)
 {
 }
Ejemplo n.º 11
0
        public void FindCommonAncestor_AFolderAndItsChild_ReturnsTheFolder()
        {
            var folder = new Folder("Folder");
            var itsChild = new Folder("Its child", folder);

            ITreeItem commonAncestor = folder.FindCommonAncestor(itsChild);

            commonAncestor.ShouldEqual(folder);
        }
Ejemplo n.º 12
0
        public void Constructor_ValidFolderName_SetsNameProperty()
        {
            var folder = new Folder("Folder Name");

            folder.Name.ShouldEqual("Folder Name");
        }