public void TestSavedDataHandlerGetAllWithSubIndexWhenNoData() { // Setup var dataHandlerUnderTest = new SavedDataHandler(this.indexOfDataSet, "NewSubIndex"); // Act var actualTable = dataHandlerUnderTest.GetAll(); // Assert Assert.IsNotNull(actualTable); }
/// <summary> /// Initializes a new instance of the <see cref="Settings"/> class. /// </summary> public Settings() { // TODO: Find a good way to provide the components initialized below. var serializer = new Serializer(); var settingsSavedDataHandler = new SavedDataHandler(SavedDataKey); this.settingsStore = new EntityStoreWithDefaults <ISetting, SettingIds>(serializer, settingsSavedDataHandler); var gameEventListener = ModuleFactory.ModuleFactorySingleton.GetModule <GameEventListener>(); gameEventListener.RegisterEvent(SystemEvent.VARIABLES_LOADED, (eventName, o) => this.LoadSettings()); }
public void TestSavedDataHandlerSetVarWithSubIndex() { // Setup var expectedTable = new NativeLuaTable(); var dataHandlerUnderTest = new SavedDataHandler(this.indexOfDataSet, this.subIndex); // Act dataHandlerUnderTest.SetVar("index", expectedTable); // Assert Assert.AreEqual(expectedTable, ((NativeLuaTable)this.dataSetInGlobal[this.subIndex])["index"]); }
public Session(Mock <IApi> apiMock, IFrames globalFrames, UiInitUtil util, FrameActor actor, ISimulatorFrameProvider frameProvider, Dictionary <string, Action> addOns, float fps, SavedDataHandler savedDataHandler, IWrapper wrapper, Action <ISession> setActiveSessionAction) { this.ApiMock = apiMock; this.Frames = globalFrames; this.FrameProvider = frameProvider; this.addOns = addOns; this.fps = fps; this.savedDataHandler = savedDataHandler; this.Util = util; this.Actor = actor; this.wrapper = wrapper; this.setActiveSessionAction = setActiveSessionAction; }
public void TestSavedDataHandlerGetVarWithoutSubIndex() { // Setup var expectedTable = new NativeLuaTable(); this.dataSetInGlobal["index"] = expectedTable; var dataHandlerUnderTest = new SavedDataHandler(this.indexOfDataSet); // Act var actualTable = dataHandlerUnderTest.GetVar("index"); // Assert Assert.AreEqual(expectedTable, actualTable); }
public ISession Build() { this.frameProvider.LoadXmlFiles(); var addOnLoadActions = new Dictionary <string, Action>(); foreach (var addon in this.addOns) { addOnLoadActions[addon.Name] = addon.Execute; } var globalFrames = new GlobalFrames(); globalFrames.UIParent = (IFrame)this.frameProvider.CreateFrame(FrameType.Frame, "UIParent"); globalFrames.UIParent.SetWidth(this.uiParentWidth); globalFrames.UIParent.SetHeight(this.uiParentHeight); globalFrames.GameTooltip = (IGameTooltip)this.frameProvider.CreateFrame(FrameType.GameTooltip, "UIParent"); var savedVariables = new List <string>(); this.addOns.ForEach(a => { if (a.SavedVariables.Length > 0) { savedVariables.AddRange(a.SavedVariables); } if (a.SavedVariablesPerCharacter.Length > 0) { savedVariables.AddRange(a.SavedVariablesPerCharacter); } }); var savedDataHandler = new SavedDataHandler(this.apiMock, savedVariables); if (this.savedVariables != null) { savedDataHandler.Load(this.savedVariables); } var wrapper = new MockObjectWrapper(this.apiMock.Object); this.MockAddOnApi(this.apiMock); var session = new Session(this.apiMock, globalFrames, this.util, this.actor, this.frameProvider, addOnLoadActions, this.fps, savedDataHandler, wrapper, this.setActiveSessionAction); this.postBuildActions.ForEach(action => action(session)); return(session); }
public void TestSavedDataHandlerGetAllWithoutSubIndex() { // Setup var expectedTable1 = new NativeLuaTable(); var expectedTable2 = new NativeLuaTable(); this.dataSetInGlobal["index1"] = expectedTable1; this.dataSetInGlobal["index2"] = expectedTable2; var dataHandlerUnderTest = new SavedDataHandler(this.indexOfDataSet); // Act var actualTable = dataHandlerUnderTest.GetAll(); // Assert Assert.AreEqual(expectedTable1, actualTable["index1"]); Assert.AreEqual(expectedTable2, actualTable["index2"]); }