Esempio n. 1
0
        /// <summary>
        /// Returns the path for storing application data common to all users, allows option to verify or create
        /// </summary>
        /// <param name="option">The option.</param>
        /// <returns>System.String.</returns>
        /// <autogeneratedoc />
        public string GetCommonApplicationDataFolderPath(Environment.SpecialFolderOption option)
        {
            if (OperatingSystem.IsOsx())
            {
                return(ProcessSpecialFolder(option, "/Users/Shared/"));
            }

            return(GetSpecialFolderPath(Environment.SpecialFolder.CommonApplicationData, option));
        }
        public void FileSystem_GetCommonApplicationDataFolderPath_Osx()
        {
            var operatingSystem = new OperatingSystem();
            Mock <IOperatingSystem> operatingSystemMock = new Mock <IOperatingSystem>();

            operatingSystemMock.Setup(osm => osm.IsWindows()).Returns(false);
            operatingSystemMock.Setup(osm => osm.IsOsx()).Returns(true);

            var fileSystem = new FileSystem(typeof(FileSystemIntegrationTests), operatingSystemMock.Object);

            var specialFolderPath = fileSystem.GetCommonApplicationDataFolderPath(Environment.SpecialFolderOption.None);

            specialFolderPath.Should().NotBeNull();

            if (operatingSystem.IsOsx())
            {
                _fileSystem.FolderExists(specialFolderPath).Should().BeTrue();
            }
        }