static private GetRandomDirectory ( string rootDirectory, IsolatedStorageScope scope ) : string | ||
rootDirectory | string | |
scope | IsolatedStorageScope | |
return | string |
static TestHelper() { s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance); s_roots = new List <string>(); string hash; object identity; Helper.GetDefaultIdentityAndHash(out identity, out hash, '.'); string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User); string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User); s_roots.Add(Path.Combine(randomUserRoot, hash)); // Application scope doesn't go under a random dir s_roots.Add(Path.Combine(userRoot, hash)); // https://github.com/dotnet/runtime/issues/2092 // https://github.com/dotnet/runtime/issues/21742 if (OperatingSystem.IsWindows() && !PlatformDetection.IsInAppContainer) { s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine)); } // We don't expose Roaming yet // Helper.GetDataDirectory(IsolatedStorageScope.Roaming); }
static TestHelper() { s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance); s_roots = new List <string>(); string hash; object identity; Helper.GetDefaultIdentityAndHash(out identity, out hash, '.'); string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User); string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User); s_roots.Add(Path.Combine(randomUserRoot, hash)); // Application scope doesn't go under a random dir s_roots.Add(Path.Combine(userRoot, hash)); // https://github.com/dotnet/corefx/issues/11124 // Need to implement ACLing for machine scope first // Helper.GetDataDirectory(IsolatedStorageScope.Machine); // We don't expose Roaming yet // Helper.GetDataDirectory(IsolatedStorageScope.Roaming); }
public void GetRandomDirectory(IsolatedStorageScope scope) { using (var temp = new TempDirectory()) { string randomDir = Helper.GetRandomDirectory(temp.Path, scope); Assert.True(Directory.Exists(randomDir)); } }