public void TestReadWrite()
        {
            var outputRecord = new VariableLengthRecord();

            outputRecord.AppendValue(100);               // unsigned int value
                outputRecord.AppendValue(200.0F);        // float value
                outputRecord.AppendValue(300.0);         // double value
                outputRecord.AppendValue('a');           // unsigned char value
                outputRecord.AppendValue("Testing");     //string value
                outputRecord.AppendValue(true);          // boolean value

            var dateValue = new Date(31, Date.Month.DECEMBER, 2100);

            outputRecord.AppendValue(dateValue);

            var dateTimeValue = new Diary.DateTime(new Date(6, Date.Month.SEPTEMBER, 1950), 12, 15);

            outputRecord.AppendValue(dateTimeValue);

            String persistenceFilePath = String.Concat(ConfigurationManager.AppSettings["PersistenceFolderPath"], "/TestFile.txt");
            var    folder = Path.GetDirectoryName(persistenceFilePath);

            // Create the persistence directory if it doesn't exist.
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            var outputStream = new RandomAccessFile(persistenceFilePath);

            outputRecord.Serialize(outputStream);
            outputStream.close();

            var inputRecord = new VariableLengthRecord();

            using (var inputStream = new RandomAccessFile(persistenceFilePath))
            {
                Assert.IsTrue(inputRecord.Deserialize(inputStream));
                Assert.AreEqual(inputRecord.GetCount(), 8, "Count");

                int value0 = 0;
                Assert.IsTrue(inputRecord.GetValue(0, ref value0));
                Assert.AreEqual(value0, 100);

                float value1 = 0.0F;
                Assert.IsTrue(inputRecord.GetValue(1, ref value1));
                Assert.AreEqual(value1, 200.0F, 0.001F);

                double value2 = 0.0;
                Assert.IsTrue(inputRecord.GetValue(2, ref value2));
                Assert.AreEqual(value2, 300.0, 0.001);

                char value3 = ' ';
                Assert.IsTrue(inputRecord.GetValue(3, ref value3));
                Assert.AreEqual(value3, 'a');

                String value4 = "";
                Assert.IsTrue(inputRecord.GetValue(4, ref value4));
                Assert.IsTrue(value4.CompareTo("Testing") == 0);

                bool value5 = false;
                Assert.IsTrue(inputRecord.GetValue(5, ref value5));
                Assert.AreEqual(value5, true);

                var value6 = new Date();
                Assert.IsTrue(inputRecord.GetValue(6, ref value6), "Date");
                Assert.AreEqual(Helper.ToString(dateValue), Helper.ToString(value6));

                var value7 = new Diary.DateTime();
                Assert.IsTrue(inputRecord.GetValue(7, ref value7), "DateTime");
                Assert.AreEqual(Helper.ToString(dateTimeValue), Helper.ToString(value7));

                inputStream.close();
            }
        }