Пример #1
0
        public void TestSimpleCreation()
        {
            var pid = ProjectId.CreateNewId();
            var map = new MonoDevelopWorkspace.DocumentMap(pid);

            var doc0 = map.Get("TestName");

            Assert.IsNull(doc0);

            var doc1 = map.GetOrCreate("TestName");
            var doc2 = map.GetOrCreate("TestName", map);
            var doc3 = map.Get("TestName");

            Assert.AreSame(doc1, doc2);
            Assert.AreSame(doc1, doc3);

            var docIdAdd = DocumentId.CreateNewId(pid);

            map.Add(docIdAdd, "TestName");

            var doc4 = map.Get("TestName");
            var doc5 = map.GetOrCreate("TestName");

            Assert.AreNotSame(doc1, doc4);
            Assert.AreSame(docIdAdd, doc4);
            Assert.AreSame(docIdAdd, doc5);

            map.Remove("TestName");

            Assert.IsNull(map.Get("TestName"));
        }
Пример #2
0
        public void TestMigration()
        {
            var pid  = ProjectId.CreateNewId();
            var map1 = new MonoDevelopWorkspace.DocumentMap(pid);
            var map2 = new MonoDevelopWorkspace.DocumentMap(pid);

            var doc1 = map1.GetOrCreate("TestName");
            var doc2 = map2.GetOrCreate("TestName");

            Assert.AreNotSame(doc1, doc2);

            map2.Remove("TestName");
            var doc3 = map2.GetOrCreate("TestName", map1);

            Assert.AreSame(doc1, doc3);
        }