public void TestSavePersistent()
        {
            string key1     = "key1";
            string toWrite1 = "val1";

            NtCore.SetEntryValue(key1, Value.MakeString(toWrite1));
            NtCore.SetEntryFlags(key1, EntryFlags.Persistent);

            string key2 = "key2";

            NtCore.SetEntryValue(key2, Value.MakeBoolean(true));
            NtCore.SetEntryFlags(key2, EntryFlags.Persistent);

            string fileName = "testfile.txt";

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            NtCore.SavePersistent(fileName);

            string[] lines = File.ReadAllLines(fileName);

            Assert.That(lines.Length, Is.GreaterThanOrEqualTo(3));
            Assert.That(lines[0], Contains.Substring("[NetworkTables Storage 3.0]"));
            Assert.That(lines[1], Contains.Substring($"string \"{key1}\"=\"{toWrite1}\""));
            Assert.That(lines[2], Contains.Substring($"boolean \"{key2}\"=true"));
        }
        public void TestGetEntries()
        {
            string key1     = "testKey";
            string toWrite1 = "written";

            NtCore.SetEntryValue(key1, Value.MakeString(toWrite1));

            string key2     = "testKey2";
            double toWrite2 = 3.58;

            NtCore.SetEntryValue(key2, Value.MakeDouble(toWrite2));
            NtCore.SetEntryFlags(key2, EntryFlags.Persistent);

            string key3     = "testKey3";
            bool   toWrite3 = true;

            NtCore.SetEntryValue(key3, Value.MakeBoolean(toWrite3));

            var entries = NtCore.GetEntryInfo("", 0);

            Assert.That(3, Is.EqualTo(entries.Count));

            Assert.That(entries[0].Name, Is.EqualTo(key1));
            Assert.That(entries[0].Type, Is.EqualTo(NtType.String));
            Assert.That(entries[0].Flags, Is.EqualTo(EntryFlags.None));
            Assert.That(entries[0].LastChange, Is.GreaterThan(0));
            Assert.That(entries[1].Name, Is.EqualTo(key2));
            Assert.That(entries[1].Type, Is.EqualTo(NtType.Double));
            Assert.That(entries[1].Flags, Is.EqualTo(EntryFlags.Persistent));
            Assert.That(entries[1].LastChange, Is.GreaterThan(0));
            Assert.That(entries[2].Name, Is.EqualTo(key3));
            Assert.That(entries[2].Type, Is.EqualTo(NtType.Boolean));
            Assert.That(entries[2].Flags, Is.EqualTo(EntryFlags.None));
            Assert.That(entries[2].LastChange, Is.GreaterThan(0));
        }
        public void TestGetEntryFlags()
        {
            string key = "testKey";

            NtCore.SetEntryValue(key, Value.MakeString("value"));

            EntryFlags flags = NtCore.GetEntryFlags(key);

            Assert.That(flags, Is.EqualTo(EntryFlags.None));

            NtCore.SetEntryFlags(key, EntryFlags.Persistent);

            flags = NtCore.GetEntryFlags(key);

            Assert.That(flags, Is.EqualTo(EntryFlags.Persistent));
        }