public void MonitorManager_SaveMonitors_Should_Save_A_Real_File() { //Arrange MonitorManager target = new MonitorManager(); target.Initialize(); HelperMethods.FillMonitorList(target); //Act target.SaveMonitors(); //Assert Assert.IsTrue(File.Exists("Monitors.xml")); }
public void MonitorManager_PingMonitors_Should_Leave_Some_HistoryData() { //Arrange int monitorAmount = 5; MonitorManager manager = new MonitorManager(); List <Monitor> monitors = HelperMethods.GenerateMonitorList(monitorAmount); //Act manager.Initialize(); manager.AddMany(monitors); manager.SaveMonitors(); manager.PingMonitors(); //Assert Assert.IsTrue(File.Exists("Data/" + DateTime.Now.ToShortDateString() + ".xml")); //Bad check, come up with something else! }
public void MonitorManager_LoadMonitors_Should_Have_A_List_Larger_Than_Zero() { //Arrange MonitorManager target = new MonitorManager(); target.Initialize(); HelperMethods.FillMonitorList(target); target.SaveMonitors(); //Act target.LoadMonitors(); //Assert Assert.IsNotNull(target.Monitors); Assert.IsTrue(target.Monitors[0].Plugins.Count > 0); Assert.IsTrue(target.Monitors.Length > 0); }
public void MonitorManager_Save_And_Load_Monitors_And_Save_And_Load_PluginSettings() { //Arrange int monitorAmount = 5; //We make a temp file name, to be sure we are testing against the right //file and not one from a previous test MonitorManager manager = new MonitorManager(); List <Monitor> monitors = HelperMethods.GenerateMonitorList(monitorAmount); monitors[0].Plugins[0].Enabled = true; //Act manager.Initialize(); manager.AddMany(monitors); manager.SaveMonitors(); manager.ClearMonitorList(); manager.LoadMonitors(); //Assert Assert.IsTrue(monitors[0].Plugins[0].Enabled == true); Assert.IsTrue(monitors[0].Plugins[1].Enabled == false); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { monitorManager.Add(monitorManager.CreateMonitor(DateTime.Now.ToString(), "http://laumania.net")); monitorManager.SaveMonitors(); MonitorsListBox.ItemsSource = monitorManager.Monitors; }