Beispiel #1
0
        public void IOStateInfoLevel1_SetupTest()
        {
            lock (_Lock)
            {
                if (_firstTime)
                {
                    _lamed.lib.IO.StateInfo.Reset(); // Cleanup state information once
                    _firstTime = false;
                }
            }

            // Setup the StateInfo if not exits
            var             person      = new IO_StateInfo_Data();
            ioStateInfo_RW1 _infoPerson = _lamed.lib.IO.StateInfo.Level1;

            _infoPerson = _lamed.lib.IO.StateInfo.Level1; // Reload all

            _infoPerson.Data_Load("Person", person);      // Load the data
            person.Name    = "Cobus";
            person.Surname = "Olivier";

            // Save the data =======================================================
            _infoPerson.Data_Save("Person", person, true);
            // =====================================================================

            var folder = _lamed.lib.IO.Folder.Path_Application();
            var file   = folder + "StateInfo_lvl1.json";

            Assert.True(_lamed.lib.IO.File.Exists(file));
        }
Beispiel #2
0
        /// <summary>Returns the level state information.</summary>
        /// <param name="level">The level.</param>
        /// <returns></returns>
        public ioStateInfo_RW Level(int level = 1)
        {
            if (level == 1)
            {
                return(_info1 ?? (_info1 = new ioStateInfo_RW1()));
            }

            // Assume level = 2
            return(_info2 ?? (_info2 = new ioStateInfo_RW2()));
        }
Beispiel #3
0
 /// <summary>Resets state memory.</summary>
 public void Reset(int level)
 {
     Level(level).Delete();
     if (level == 1)
     {
         _info1 = null;
     }
     if (level == 2)
     {
         _info2 = null;
     }
 }