Exemplo n.º 1
0
        public void GetAndSetCustomSettingsTest()
        {
            XmlDocument       xml      = new XmlDocument();
            ComponentSettings settings = new ComponentSettings();

            settings.AutoSplitEnabled   = false;
            settings.LoadRemovalEnabled = true;
            settings.LabSplitType       = ComponentSettings.LabSplitMode.Trials;
            settings.GenerateWithIcons  = false;
            settings.CriteriaToSplit    = ComponentSettings.SplitCriteria.Levels;
            settings.SplitZones.Add(Zone.ZONES[0]);
            settings.SplitZoneLevels.Add(70);
            settings.SplitLevels.Add(100);
            XmlNode node = settings.GetSettings(xml);

            settings = new ComponentSettings();
            settings.SetSettings(node);
            Assert.IsFalse(settings.AutoSplitEnabled);
            Assert.IsTrue(settings.LoadRemovalEnabled);
            Assert.AreEqual(ComponentSettings.LabSplitMode.Trials, settings.LabSplitType);
            Assert.IsFalse(settings.GenerateWithIcons);
            Assert.AreEqual(ComponentSettings.SplitCriteria.Levels, settings.CriteriaToSplit);
            Assert.IsTrue(new HashSet <IZone> {
                Zone.ZONES[0]
            }.SetEquals(settings.SplitZones));
            Assert.IsTrue(new HashSet <int> {
                70
            }.SetEquals(settings.SplitZoneLevels));
            Assert.IsTrue(new HashSet <int> {
                100
            }.SetEquals(settings.SplitLevels));
        }
        public void GetAndSetDefaultSettingsTest()
        {
            XmlDocument       xml      = new XmlDocument();
            ComponentSettings settings = new ComponentSettings();
            XmlNode           node     = settings.GetSettings(xml);

            settings = new ComponentSettings();
            settings.SetSettings(node);
            Assert.IsTrue(settings.AutoSplitEnabled);
            Assert.IsFalse(settings.LoadRemovalEnabled);
            Assert.AreEqual(ComponentSettings.LabSplitMode.AllZones, settings.LabSplitType);
            Assert.IsTrue(settings.GenerateWithIcons);
            Assert.AreEqual(ComponentSettings.SplitCriteria.Zones, settings.CriteriaToSplit);
            Assert.AreEqual(0, settings.SplitZones.Count);
            Assert.AreEqual(0, settings.SplitLevels.Count);
        }
 public override XmlNode GetSettings(XmlDocument document)
 {
     return(settings.GetSettings(document));
 }