public void TestReconfiguration() { RollbarLoggerConfig config = new RollbarLoggerConfig(); Assert.AreEqual("seedToken", config.RollbarDestinationOptions.AccessToken); Console.WriteLine(config.TraceAsString()); config.Reconfigured += Config_Reconfigured; Assert.AreEqual(0, this._actualReconfigCount); IRollbarDestinationOptions rollbarDestinationOptions = config.RollbarDestinationOptions; RollbarDestinationOptions destinationOptions = new RollbarDestinationOptions(); destinationOptions.AccessToken = "CUSTOM"; config.RollbarDestinationOptions.Reconfigure(destinationOptions); Assert.AreEqual(1, this._actualReconfigCount); Assert.AreSame(rollbarDestinationOptions, config.RollbarDestinationOptions); Assert.AreEqual("CUSTOM", config.RollbarDestinationOptions.AccessToken, "Options reconfig works!"); Console.WriteLine(config.TraceAsString()); RollbarLoggerConfig newConfig = new RollbarLoggerConfig(); Assert.AreEqual("seedToken", newConfig.RollbarDestinationOptions.AccessToken); Console.WriteLine(newConfig.TraceAsString()); Assert.AreNotSame(rollbarDestinationOptions, newConfig.RollbarDestinationOptions); newConfig.Reconfigured += Config_Reconfigured; rollbarDestinationOptions = newConfig.RollbarDestinationOptions; newConfig.Reconfigure(config); Assert.AreEqual(8, this._actualReconfigCount); Assert.AreEqual("CUSTOM", newConfig.RollbarDestinationOptions.AccessToken, "Structured config's reconfig works!"); Console.WriteLine(newConfig.TraceAsString()); Assert.AreSame(rollbarDestinationOptions, newConfig.RollbarDestinationOptions); Assert.AreNotSame(config, newConfig); Assert.AreNotSame(config.RollbarDestinationOptions, newConfig.RollbarDestinationOptions); }
public void TestBasics() { RollbarLoggerConfig config = new RollbarLoggerConfig(); Console.WriteLine(config.TraceAsString()); var results = config.Validate(); Assert.AreEqual(1, results.Count, "One Validation Rule failed!"); Console.WriteLine("Validation Results:"); foreach (var result in results) { Console.WriteLine($" {result}"); } Console.WriteLine(); }