public void BiDirectionalDictionaryInitSmaller()

        {
            var bi = new BiDirectionalDictionary <int, int>(1);

            Assert.AreEqual(0, bi.Count);
            bi.Add(1, 1);
            Assert.AreEqual(1, bi.Count);
            bi.Add(2, 2);
            Assert.AreEqual(2, bi.Count);
        }
        public void BiDirectionalDictionaryCount()

        {
            var bi = new BiDirectionalDictionary <int, int>();

            Assert.AreEqual(0, bi.Count);
            bi.Add(1, 1);
            Assert.AreEqual(1, bi.Count);
            bi.Add(2, 2);
            Assert.AreEqual(2, bi.Count);
            bi.Clear();
            Assert.AreEqual(0, bi.Count);
        }
        public void BiDirectionalDictionaryAddException2()

        {
            var bi = new BiDirectionalDictionary <int, int> {
                { 1, 1 }, { 2, 2 }
            };

            Assert.AreEqual(2, bi.Count);
            var exception = false;

            try
            {
                bi.Add(1, 3);
            }
            catch (ArgumentException)
            {
                exception = true;
            }
            catch (Exception ex)
            {
                Assert.Fail("Wrong Exception Type: " + ex.GetType());
            }

            Assert.IsTrue(exception, "No Exception thrown");
        }
    //Creates a new transformation sequence on this character and maps it to the invoking transformation line.
    private CharacterForm createNewTransformation(TransformationLine i_TransformationLine)
    {
        if (r_FormLineDict[i_TransformationLine])
        {
            throw new ArgumentException("A form already exists for given transformation line on this character");
        }

        CharacterForm newForm = m_NextForm;

        i_TransformationLine.OnLineFinished += TransformationLine_LineFinished;
        newForm.OnTransformationComplete    += CharacterForm_TransformationComplete;

        r_FormLineDict.Add(newForm, i_TransformationLine);

        return(newForm);
    }
예제 #5
0
        public Category NewCategory(string idString, string name)
        {
            Category result;

            if (_publicCategories != null && _publicCategories.TryGetValue(idString, out result))
            {
                return(result);
            }
            if (_guestCategories != null && _guestCategories.TryGetValue(idString, out result))
            {
                return(result);
            }

            int numericalID = _nextUnusedCategoryId++;

            _numericCategoryIdCache.Add(idString, numericalID);

            Category category = new Category
            {
                ID        = numericalID,
                IdString  = idString,
                Name      = name,
                Navigator = this
            };

            CoreManager.ServerCore.GetStandardOut().PrintDebug("Navigator Manager => Category created: " + numericalID +
                                                               ", idstring, " + name);

            if (OnCategoryCreated != null)
            {
                OnCategoryCreated.Invoke(category, new CategoryEventArgs
                {
                    Navigator = this
                });
            }
            return(category);
        }