public void setMementoTest_nullstate() { Macro_Accessor target = new Macro_Accessor(); string mementoname = "testmemento"; Memento memento = new Memento(mementoname, null); target.setMemento(memento); Assert.AreNotEqual<string>(mementoname, target.rootEntry.mementoName, "The invalid memento was partly loaded."); Assert.IsNotNull(target.rootEntry.macroEntries, "Macro was set to null."); }
public void setMementoTest_ok() { Macro_Accessor target = new Macro_Accessor(); string mementoname = "setmementotestmemento"; string entrymementoname = "settestMemento"; MacroEntry macroentry = new MacroEntry("testPlugin", PluginType.IMacro, entrymementoname); MacroEntry subentry = new MacroEntry("testPlugin2", PluginType.IFilterOqat, "testMemento2"); macroentry.macroEntries.Add(subentry); Memento memento = new Memento(mementoname, macroentry); target.setMemento(memento); Assert.AreEqual<string>(entrymementoname, target.rootEntry.mementoName, "The memento's state was not loaded."); Assert.AreEqual(subentry, macroentry.macroEntries[0]); }
public void getMementoTest() { Macro_Accessor target = new Macro_Accessor(); string mementoname = "setmementotestmemento"; MacroEntry macroentry = new MacroEntry("testPlugin", PluginType.IFilterOqat, "testMemento"); MacroEntry subentry = new MacroEntry("testPlugin2", PluginType.IFilterOqat, "testMemento2"); macroentry.macroEntries.Add(subentry); Memento memento = new Memento(mementoname, macroentry); target.setMemento(memento); Memento actual; actual = target.getMemento(); Assert.IsNotNull(actual, "Memento not returned."); Assert.AreEqual(mementoname, actual.name); Assert.IsNotNull(actual.state, "Memento is empty"); Assert.AreEqual(subentry, ((MacroEntry)actual.state).macroEntries[0]); }