Esempio n. 1
0
        public void LoadMonitors()
        {
            monitors = MonitorDataStore.Load();

            //Satisfy the Export/Import attributes (MEF)
            foreach (var monitor in monitors)
            {
                pluginManager.ComposePart(monitor);
            }

            //We have to load in Plugin settings AFTER we satisfied the Exports/Imports
            PluginsDataStore.Load(monitors);
        }
        public void MonitorDataStore_Save_And_Load_Monitor_File()
        {
            //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
            string         tempFilename   = "Monitors_" + Guid.NewGuid() + ".xml";
            List <Monitor> monitors       = HelperMethods.GenerateMonitorList(monitorAmount);
            List <Monitor> loadedMonitors = null;

            //Act
            MonitorDataStore.Save(monitors, tempFilename);
            loadedMonitors = MonitorDataStore.Load(tempFilename);

            //Assert
            Assert.IsTrue(monitors.Count == loadedMonitors.Count);
            Assert.IsTrue(monitors[3].Id == loadedMonitors[3].Id);

            //Cleanup
            File.Delete(tempFilename);
        }
Esempio n. 3
0
 public void SaveMonitors()
 {
     MonitorDataStore.Save(monitors);
     PluginsDataStore.Save(monitors);
 }