Пример #1
0
		// Analysis disable once InconsistentNaming
		public void GetUserCacheDir_ReturnsHome_WhenXdgCacheHomeNotSet ()
		{
			var environment = new EnvironmentMock ("HOME", "/home/user");
			var xdg = new XdgDirectoryService (null, environment.Object);

			var result = xdg.GetUserCacheDir ();

			Assert.AreEqual ("/home/user/.cache", result);
		}
Пример #2
0
        // Analysis disable once InconsistentNaming
        public void GetUserCacheDir_ReturnsHome_WhenXdgCacheHomeNotSet()
        {
            var environment = new EnvironmentMock("HOME", "/home/user");
            var xdg         = new XdgDirectoryService(null, environment.Object);

            var result = xdg.GetUserCacheDir();

            Assert.AreEqual("/home/user/.cache", result);
        }
Пример #3
0
		// Analysis disable once InconsistentNaming
		public void GetUserCacheDir_ReturnsXdgCacheHome_WhenXdgCacheHomeSet ()
		{
			var environment = new EnvironmentMock ("XDG_CACHE_HOME", "/path/to/.cache");
			var xdg = new XdgDirectoryService (null, environment.Object);

			var result = xdg.GetUserCacheDir ();

			Assert.AreEqual ("/path/to/.cache", result);
		}
Пример #4
0
        // Analysis disable once InconsistentNaming
        public void GetUserCacheDir_ReturnsXdgCacheHome_WhenXdgCacheHomeSet()
        {
            var environment = new EnvironmentMock("XDG_CACHE_HOME", "/path/to/.cache");
            var xdg         = new XdgDirectoryService(null, environment.Object);

            var result = xdg.GetUserCacheDir();

            Assert.AreEqual("/path/to/.cache", result);
        }
Пример #5
0
        // Analysis disable once InconsistentNaming
        public void GethThumbnailsDir_ReturnsFolderForNormalThumbnails()
        {
            var environment = new EnvironmentMock("XDG_CACHE_HOME", "/path/to/.cache");
            var xdg         = new XdgDirectoryService(null, environment.Object);

            var result = xdg.GetThumbnailsDir(ThumbnailSize.Normal);

            Assert.AreEqual("/path/to/.cache/thumbnails/normal", result);
        }
Пример #6
0
        // Analysis disable once InconsistentNaming
        public void GethThumbnailsDir_ReturnsFolderForNormalThumbnails()
        {
            var environment = new EnvironmentMock("XDG_CACHE_HOME", pathToCache);
            var xdg         = new XdgDirectoryService(null, environment.Object);

            var result = xdg.GetThumbnailsDir(ThumbnailSize.Normal);

            Assert.AreEqual(Path.Combine("path", "to", ".cache", "thumbnails", "normal"), result);
        }
Пример #7
0
        // Analysis disable once InconsistentNaming
        public void GetUserCacheDir_ReturnsXdgCacheHome_WhenXdgCacheHomeAndHomeAreSet()
        {
            var environment = new EnvironmentMock("XDG_CACHE_HOME", pathToCache);

            environment.SetVariable("HOME", homeDir);
            var xdg = new XdgDirectoryService(null, environment.Object);

            var result = xdg.GetUserCacheDir();

            Assert.AreEqual(pathToCache, result);
        }
Пример #8
0
        // Analysis disable once InconsistentNaming
        public void GetUserCacheDir_ReturnsCachedValue_WhenXdgCacheHomeIsChanged()
        {
            var environment = new EnvironmentMock("XDG_CACHE_HOME", "/first/path/.cache");
            var xdg         = new XdgDirectoryService(null, environment.Object);

            xdg.GetUserCacheDir();
            environment.SetVariable("XDG_CACHE_HOME", "/second/path/.cache");

            var result = xdg.GetUserCacheDir();

            Assert.AreEqual("/first/path/.cache", result);
        }
Пример #9
0
        // Analysis disable once InconsistentNaming
        public void GetUserCacheDir_ReturnsTempPath_WhenXdgCacheHomeAndHomeNotSet()
        {
            var environment = EnvironmentMock.Create("user");
            var fileSystem  = new Mock <IFileSystem> {
                DefaultValue = DefaultValue.Mock
            };
            var path     = fileSystem.Object.Path;
            var pathMock = Mock.Get(path);

            pathMock.Setup(p => p.GetTempPath()).Returns("/temp/path");

            var result = new XdgDirectoryService(fileSystem.Object, environment).GetUserCacheDir();

            Assert.AreEqual("/temp/path/user/.cache", result);
        }
Пример #10
0
		// Analysis disable once InconsistentNaming
		public void GetUserCacheDir_ReturnsCachedValue_WhenXdgCacheHomeIsChanged ()
		{
			var environment = new EnvironmentMock ("XDG_CACHE_HOME", "/first/path/.cache");
			var xdg = new XdgDirectoryService (null, environment.Object);
			xdg.GetUserCacheDir ();
			environment.SetVariable ("XDG_CACHE_HOME", "/second/path/.cache");

			var result = xdg.GetUserCacheDir ();

			Assert.AreEqual ("/first/path/.cache", result);
		}
Пример #11
0
		// Analysis disable once InconsistentNaming
		public void GetUserCacheDir_ReturnsTempPath_WhenXdgCacheHomeAndHomeNotSet ()
		{
			var environment = EnvironmentMock.Create ("user");
			var fileSystem = new Mock<IFileSystem> { DefaultValue = DefaultValue.Mock };
			var path = fileSystem.Object.Path;
			var pathMock = Mock.Get (path);
			pathMock.Setup (p => p.GetTempPath ()).Returns ("/temp/path");

			var result = new XdgDirectoryService (fileSystem.Object, environment).GetUserCacheDir ();

			Assert.AreEqual ("/temp/path/user/.cache", result);
		}
Пример #12
0
		// Analysis disable once InconsistentNaming
		public void GethThumbnailsDir_ReturnsFolderForNormalThumbnails ()
		{
			var environment = new EnvironmentMock ("XDG_CACHE_HOME", "/path/to/.cache");
			var xdg = new XdgDirectoryService (null, environment.Object);

			var result = xdg.GetThumbnailsDir (ThumbnailSize.Normal);

			Assert.AreEqual ("/path/to/.cache/thumbnails/normal", result);
		}