public void Enabled() { // Create a new SMTP server (evee though it//s set to client) var server = new System.Net.Mail.SmtpClient(); // Server should be disabled by default Assert.IsFalse(server.Enabled()); // Set Enableemail to false in the configuration System.Configuration.ConfigurationManager.AppSettings.Set("Enableemail", "false"); // Server should be disabled as per the configuration Assert.IsFalse(server.Enabled()); // Set the Enableemail to true in the configuration System.Configuration.ConfigurationManager.AppSettings.Set("Enableemail", "true"); // Server should now be enabled Assert.IsTrue(server.Enabled()); // Clean up configuration settings System.Configuration.ConfigurationManager.AppSettings["Enableemail"] = null; // Server should now be disabled Assert.IsFalse(server.Enabled()); }