public void ReadConfigurationXmlIgnoresMissingApplicationInsightsConfigurationFileByReturningEmptyString() { var platform = new PlatformImplementation(); string configuration = platform.ReadConfigurationXml(); Assert.AreEqual(0, configuration.Length); }
public void GetApplicationSettingsReturnsDictionaryFromIsolatedStorageSettings() { var platform = new PlatformImplementation(); IDictionary <string, object> settings = platform.GetApplicationSettings(); Assert.NotNull(settings); Assert.Same(IsolatedStorageSettings.ApplicationSettings, settings); }
public void ReadConfigurationXmlReturnsContentsOfApplicationInsightsConfigFileInApplicationInstallationDirectory() { const string TestFileContent = "42"; CreateConfigurationFile(TestFileContent); var platform = new PlatformImplementation(); string s = platform.ReadConfigurationXml(); Assert.AreEqual(TestFileContent, s); }
public void FailureToReadEnvironmentVariablesDoesNotThrowExceptions() { EnvironmentPermission permission = new EnvironmentPermission(EnvironmentPermissionAccess.NoAccess, "PATH"); try { permission.PermitOnly(); PlatformImplementation platform = new PlatformImplementation(); Assert.IsNull(platform.GetEnvironmentVariable("PATH")); permission = null; } finally { EnvironmentPermission.RevertAll(); } }
public void GetApplicationSettingsReturnsDictionaryFromLocalSettingsOfApplicationData() { string testKey = Guid.NewGuid().ToString(); string testValue = Guid.NewGuid().ToString(); ApplicationData.Current.LocalSettings.Values[testKey] = testValue; try { var platform = new PlatformImplementation(); IDictionary<string, object> settings = platform.GetApplicationSettings(); // Can't use object reference equality here because ApplicationData.Current.LocalSettings.Values returns a new instance every time Assert.Equal(testValue, settings[testKey]); } finally { ApplicationData.Current.LocalSettings.Values.Remove(testKey); } }
public void GetApplicationSettingsReturnsDictionaryFromLocalSettingsOfApplicationData() { string testKey = Guid.NewGuid().ToString(); string testValue = Guid.NewGuid().ToString(); ApplicationData.Current.LocalSettings.Values[testKey] = testValue; try { var platform = new PlatformImplementation(); IDictionary <string, object> settings = platform.GetApplicationSettings(); // Can't use object reference equality here because ApplicationData.Current.LocalSettings.Values returns a new instance every time Assert.Equal(testValue, settings[testKey]); } finally { ApplicationData.Current.LocalSettings.Values.Remove(testKey); } }