Пример #1
0
        public void TestDictSerializationPass()
        {
            var instance  = new TestObject();
            var reference = new SerializedDictionary <int, string>();

            instance.var1 = reference;
            reference.Add(1, "A");
            reference.Add(2, "B");
            reference.Add(3, "C");

            Assert.AreEqual(reference.Count, 3);
            Assert.AreEqual(reference.ContainsKey(1), true);
            Assert.AreEqual(reference.ContainsKey(2), true);
            Assert.AreEqual(reference.ContainsKey(3), true);
            Assert.AreEqual(reference[2], "B");
        }
Пример #2
0
    private SerializedDictionary <string, KalsiumObject> BuildDict()
    {
        var res = new SerializedDictionary <string, KalsiumObject>();

        sources.RemoveAll(v => v == null);
        foreach (var source in sources)
        {
            Debug.Assert(source.identifier != "", source);
            Debug.Assert(!res.ContainsKey(source.identifier), source);
            res.Add(source.identifier, source);
        }
        return(res);
    }