public void ComplexTypeShortcut_Property_LoadedValueEqualsShortcutValue()
        {
            var SAVED_VALUE = ComplexType.PropertyShortcut;
            var file        = new MemoryReadOnlyDataFile($"{SAVED_VALUE_KEY}:PropertyShortcut");

            var loadedValue = file.Get <ComplexType>(SAVED_VALUE_KEY, null);

            Assert.AreEqual(SAVED_VALUE, loadedValue);
        }
Example #2
0
        public static void PerformParsingErrorTest <TData>(string validFileStructure_invalidData)
        {
            var file = new MemoryReadOnlyDataFile(validFileStructure_invalidData);

            // Use try/catch instead of Assert.ThrowsException so we can print the exception details.
            // The point of these tests is to make sure the exceptions are working properly, so it's nice to
            // manually check that the error messages are what they should be.
            // It might be cool in the future to actually test that the error messages, or at least the line numbers, are correct.
            try
            {
                file.Get <TData>("data");
            }
            catch (CannotRetrieveDataFromNodeException expectedException)
            {
                Console.WriteLine("Got expected exception:");
                Console.WriteLine(expectedException);
            }
        }