public void SaveLoadRules() { ArchiverMain archiver = ArchiverMain.Current; CreateFewChannels(); Assert.IsEmpty(archiver.ChannelsSettings.Rules); Rule newRule = new Rule(); newRule.Name = "Test rule"; newRule.AddChannel(archiver.ChannelsSettings.Channels[0]); newRule.AddChannel(archiver.ChannelsSettings.Channels[1]); newRule.AddCondition(new TimeIntervalCondition(12345)); archiver.ChannelsSettings.AddRule(newRule); Assert.IsNotEmpty(archiver.ChannelsSettings.Rules); archiver.ChannelsSettings.Save(); ArchiverMain.Deinitialize(); ArchiverMain.Initialize(); archiver = ArchiverMain.Current; archiver.ChannelsSettings.Rules = new List <Rule>(); archiver.ChannelsSettings.Load(); Assert.IsNotEmpty(archiver.ChannelsSettings.Rules); Assert.AreEqual(newRule.Name, archiver.ChannelsSettings.Rules[0].Name); Assert.AreEqual(newRule.Channels[0].ChannelName, archiver.ChannelsSettings.Rules[0].Channels[0].ChannelName); Assert.AreEqual(newRule.Channels[1].ChannelName, archiver.ChannelsSettings.Rules[0].Channels[1].ChannelName); Assert.AreEqual((newRule.Conditions[0] as TimeIntervalCondition).Interval, (archiver.ChannelsSettings.Rules[0].Conditions[0] as TimeIntervalCondition).Interval); }
public override void TearDown() { ArchiverMain.Deinitialize(); Env.Deinitialize(); }