public void CanEnableLoggingFromConfig() { var client = new ExceptionlessClient(); ClientConfiguration config = ClientConfiguration.Create(client); string logPath = config.LogPath; Assert.NotNull(config); Assert.True(config.EnableLogging); //Assert.Equal(logPath, config.LogPath); // TODO: Should this even be set to a value?? It's Isolated storage? Assert.NotNull(client.Log); Assert.NotNull(client); Assert.Equal(typeof(SafeExceptionlessLog), client.Log.GetType()); client.ProcessQueue(); client.Shutdown(); var dir = new IsolatedStorageDirectory(DEFAULT_STORE); Assert.True(dir.FileExists(logPath)); string content = dir.ReadFileAsString(logPath); Assert.True(content.Length > 10); }
protected override string GetLogContent(string path = LOG_FILE) { if (!LogExists(path)) { return(String.Empty); } return(_directory.ReadFileAsString(path)); }
public void CreateNewConfiguration() { DeleteConfig(); var client = new ExceptionlessClient(); LocalConfigurationDictionary localConfiguration = LocalConfigurationDictionary.Create(DEFAULT_STORE, client); Assert.NotNull(localConfiguration); Assert.False(localConfiguration.IsDirty); Assert.NotEqual(Guid.Empty, localConfiguration.InstallIdentifier); using (var store = new IsolatedStorageDirectory(DEFAULT_STORE)) { Assert.True(store.FileExists(CONFIG_FILENAME)); Console.WriteLine(store.ReadFileAsString(CONFIG_FILENAME)); } }
public void CreateNewConfiguration() { DeleteConfig(); var client = new ExceptionlessClient(); LocalConfigurationDictionary localConfiguration = LocalConfigurationDictionary.Create(DEFAULT_STORE, client); Assert.NotNull(localConfiguration); Assert.False(localConfiguration.IsDirty); Assert.NotEqual(Guid.Empty, localConfiguration.InstallIdentifier); using (var store = new IsolatedStorageDirectory(DEFAULT_STORE)) { Assert.True(store.FileExists(CONFIG_FILENAME)); Console.WriteLine(store.ReadFileAsString(CONFIG_FILENAME)); } }
public void MultiThreadedSaveLocalConfiguration() { DeleteConfig(); var client = new ExceptionlessClient(); Parallel.For(0, 200, i => { Exception exception = Record.Exception(() => { LocalConfigurationDictionary localConfiguration = LocalConfigurationDictionary.Create(DEFAULT_STORE, client); Assert.NotNull(localConfiguration); localConfiguration.IsDirty = true; localConfiguration["ExpireTokenDate"] = DateTime.Now.AddMinutes(i).ToString(); localConfiguration.StartCount++; Task.Factory.StartNew(() => localConfiguration["ExpireTokenDate"] = DateTime.Now.AddMinutes(i + 1).ToString()); localConfiguration.Save(); Assert.NotNull(LocalConfigurationDictionary.Create(DEFAULT_STORE, client)); localConfiguration.IsDirty = true; localConfiguration["ExpireTokenDate"] = DateTime.Now.AddMinutes(i).ToString(); Task.Factory.StartNew(() => localConfiguration.Remove("ExpireTokenDate")); localConfiguration.Save(); Assert.NotNull(LocalConfigurationDictionary.Create(DEFAULT_STORE, client)); localConfiguration.StartCount++; localConfiguration.IsDirty = true; Assert.True(localConfiguration.Save(), "Saved"); Assert.NotNull(LocalConfigurationDictionary.Create(DEFAULT_STORE, client)); }); Assert.Null(exception); }); using (var store = new IsolatedStorageDirectory(DEFAULT_STORE)) { Console.WriteLine(store.GetFullPath(CONFIG_FILENAME)); Assert.True(store.FileExists(CONFIG_FILENAME)); Console.WriteLine(store.ReadFileAsString(CONFIG_FILENAME)); } }
public void CanEnableLoggingFromConfig() { var client = new ExceptionlessClient(); ClientConfiguration config = ClientConfiguration.Create(client); string logPath = config.LogPath; Assert.NotNull(config); Assert.True(config.EnableLogging); //Assert.Equal(logPath, config.LogPath); // TODO: Should this even be set to a value?? It's Isolated storage? Assert.NotNull(client.Log); Assert.NotNull(client); Assert.Equal(typeof(SafeExceptionlessLog), client.Log.GetType()); client.ProcessQueue(); client.Shutdown(); var dir = new IsolatedStorageDirectory(DEFAULT_STORE); Assert.True(dir.FileExists(logPath)); string content = dir.ReadFileAsString(logPath); Assert.True(content.Length > 10); }
public void MultiThreadedSaveLocalConfiguration() { DeleteConfig(); var client = new ExceptionlessClient(); Parallel.For(0, 200, i => { Exception exception = Record.Exception(() => { LocalConfigurationDictionary localConfiguration = LocalConfigurationDictionary.Create(DEFAULT_STORE, client); Assert.NotNull(localConfiguration); localConfiguration.IsDirty = true; localConfiguration["ExpireTokenDate"] = DateTime.Now.AddMinutes(i).ToString(); localConfiguration.StartCount++; Task.Factory.StartNew(() => localConfiguration["ExpireTokenDate"] = DateTime.Now.AddMinutes(i + 1).ToString()); localConfiguration.Save(); Assert.NotNull(LocalConfigurationDictionary.Create(DEFAULT_STORE, client)); localConfiguration.IsDirty = true; localConfiguration["ExpireTokenDate"] = DateTime.Now.AddMinutes(i).ToString(); Task.Factory.StartNew(() => localConfiguration.Remove("ExpireTokenDate")); localConfiguration.Save(); Assert.NotNull(LocalConfigurationDictionary.Create(DEFAULT_STORE, client)); localConfiguration.StartCount++; localConfiguration.IsDirty = true; Assert.True(localConfiguration.Save(), "Saved"); Assert.NotNull(LocalConfigurationDictionary.Create(DEFAULT_STORE, client)); }); Assert.Null(exception); }); using (var store = new IsolatedStorageDirectory(DEFAULT_STORE)) { Console.WriteLine(store.GetFullPath(CONFIG_FILENAME)); Assert.True(store.FileExists(CONFIG_FILENAME)); Console.WriteLine(store.ReadFileAsString(CONFIG_FILENAME)); } }