예제 #1
0
        public void TestGetCacheHome_hasXdgCacheHome()
        {
            Mock.Get(mockEnvironment).Setup(e => e.GetEnvironmentVariable("XDG_CACHE_HOME")).Returns(fakeCacheHome);

            Assert.AreEqual(
                Paths.Get(fakeCacheHome),
                UserCacheHome.GetCacheHome(mockEnvironment));
        }
예제 #2
0
        public void TestGetCacheHome_linux()
        {
            Mock.Get(mockEnvironment).Setup(e => e.GetFolderPath(Environment.SpecialFolder.UserProfile))
            .Returns(fakeCacheHome);

            Assert.AreEqual(
                Paths.Get(fakeCacheHome, ".cache"),
                UserCacheHome.GetCacheHome(mockEnvironment));
        }
예제 #3
0
        public void TestGetCacheHome_windows()
        {
            Mock.Get(mockEnvironment).Setup(e => e.GetFolderPath(Environment.SpecialFolder.UserProfile))
            .Returns("nonexistent");
            Mock.Get(mockEnvironment).Setup(e => e.GetFolderPath(Environment.SpecialFolder.LocalApplicationData))
            .Returns(fakeCacheHome);

            Assert.AreEqual(
                Paths.Get(fakeCacheHome), UserCacheHome.GetCacheHome(mockEnvironment));
        }
예제 #4
0
        public void TestGetCacheHome_mac()
        {
            SystemPath libraryApplicationSupport = Paths.Get(fakeCacheHome, "Library", "Application Support");

            Files.CreateDirectories(libraryApplicationSupport);

            Mock.Get(mockEnvironment).Setup(e => e.GetFolderPath(Environment.SpecialFolder.UserProfile))
            .Returns(fakeCacheHome);
            Mock.Get(mockEnvironment).Setup(e => e.IsOsx()).Returns(true);

            Assert.AreEqual(
                libraryApplicationSupport,
                UserCacheHome.GetCacheHome(mockEnvironment));
        }