Ejemplo n.º 1
0
        public void ReturnsValid_RootPath()
        {
            var musicFolder    = new MusicFolder("test", true);
            var newFilePath    = musicFolder.MoveFile(CreateFile()).NewFilePath;
            var folderLocation = MusicFolderLocation.Parse(newFilePath);

            Assert.True(folderLocation.RootPath.Equals(musicFolder.Path, StringComparison.OrdinalIgnoreCase));
        }
Ejemplo n.º 2
0
        public void ReturnsValid_Year()
        {
            var musicFolder    = new MusicFolder("test", true);
            var newFilePath    = musicFolder.MoveFile(CreateFile()).NewFilePath;
            var expectedYear   = DateTime.Now.Year;
            var folderLocation = MusicFolderLocation.Parse(newFilePath);

            Assert.AreEqual(expectedYear, folderLocation.Year);
        }
Ejemplo n.º 3
0
        public void ReturnsValid_InnerFolderNumber()
        {
            var       musicFolder         = new MusicFolder("test", true);
            var       newFilePath         = musicFolder.MoveFile(CreateFile()).NewFilePath;
            const int expectedInnerFolder = 0;
            var       folderLocation      = MusicFolderLocation.Parse(newFilePath);

            Assert.AreEqual(expectedInnerFolder, folderLocation.InnerFolder);
        }
Ejemplo n.º 4
0
        public void Add(string path, HashTagModel model, int priority = 0)
        {
            Contract.Requires(path != null);
            Contract.EndContractBlock();

            path = PathExtension.Normalize(path);

            if (!pathMusicFolderDictionary.ContainsKey(path))
            {
                var musicFolder = new MusicFolder(path);
                pathMusicFolderDictionary[path] = musicFolder;
            }

            var pattern = new HashTagModelPattern(model, priority);

            if (patternFolderDictionary.ContainsKey(pattern))
            {
                throw new PatternAlreadyExistsException();
            }

            patternFolderDictionary.Add(pattern, path);
        }