Example #1
0
        public void AddStrings(StringCollection collection)
        {
            string newID;

            newID = collection.GenerateNewID();
            collection.AddString(newID, time);
            time = newID;

            newID = collection.GenerateNewID();
            collection.AddString(newID, location);
            location = newID;
        }
Example #2
0
        public void AddStrings(StringCollection collection)
        {
            string newID = collection.GenerateNewID();

            collection.AddString(newID, dialogue);
            dialogue = newID;
        }
Example #3
0
        public void AddStrings(StringCollection collection)
        {
            string newID = collection.GenerateNewID();

            collection.AddString(newID, choiceText);
            choiceText = newID;
        }
Example #4
0
        public static void TestStringCollection()
        {
            var testCollection = new StringCollection();

            string testID        = "test_id";
            string testString    = "test_string";
            string testStringTwo = "test_string_two";

            testCollection.AddString(testID, testString);
            string testNewString = testCollection.GetString(testID);

            Debug.Assert(testString.Equals(testNewString), "Input/output replication test failed for StringCollection");

            bool exceptionCaught;

            try
            {
                // Adding same string with same ID
                testCollection.AddString(testID, testString);
                exceptionCaught = false;
            }
            catch (Exception e)
            {
                exceptionCaught = true;
            }

            Debug.Assert(exceptionCaught == false, "Same ID same string test failed for StringCollection");

            try
            {
                // Adding different string with same ID
                testCollection.AddString(testID, testStringTwo);
                exceptionCaught = false;
            }
            catch (Exception e)
            {
                exceptionCaught = true;
            }

            Debug.Assert(exceptionCaught == true, "Same ID different string test failed for StringCollection");

            try
            {
                // Trying to access non-existent string
                string nonExistentID     = "afesrgrt3qr\aefgsgggaftr3qr4q4";
                string nonExistentString = testCollection.GetString(nonExistentID);
                exceptionCaught = false;
            }
            catch (Exception e)
            {
                exceptionCaught = true;
            }

            Debug.Assert(exceptionCaught == true, "Non-existent ID test failed for StringCollection");

            var testCollectionWithID = new StringCollection("TEST");

            Debug.Assert(testCollectionWithID.GenerateNewID() == "$TEST_0", "ID generation test failed for StringCollection"); // this test does not account for variable idPrefix etc. which are technicallty not supported at the moment
        }