예제 #1
0
        public void BugBinaryBadContent()
        {
            INamedVersionedUniqueId uid1 = SharedDicTestContext.Plugins[0];
            INamedVersionedUniqueId uid2 = SharedDicTestContext.Plugins[1];
            string path = TestBase.GetTestFilePath("SharedDic", "BugBinaryBadContent");

            SharedDictionaryTester checker = new SharedDictionaryTester("BugBinaryBadContent", path, this, uid1, uid2, (d, o, id) => d[o, id, "Obj"] = new SerializableObject());

            Assert.Throws <XmlException>(() =>
            {
                checker.WriteAndReadWithTests
                (
                    d =>
                {
                    XmlNode n   = d.SelectSingleNode(@"CK-Structured/BugBinaryBadContent/p/data[@key=""Obj""]");
                    n.InnerText = n.InnerText.Insert(n.InnerText.Length / 2, "*bug*");
                },
                    dic => { dic.Ensure(uid1); dic.Ensure(uid2); }
                );
            });
        }
예제 #2
0
        public void BugBinarySizeDiffer()
        {
            INamedVersionedUniqueId uid1 = SharedDicTestContext.Plugins[0];
            INamedVersionedUniqueId uid2 = SharedDicTestContext.Plugins[1];
            string path = TestBase.GetTestFilePath("SharedDic", "BugBinarySizeDiffer");

            SharedDictionaryTester checker = new SharedDictionaryTester("BugBinarySizeDiffer", path, this, uid1, uid2, (d, o, id) => d[o, id, "Obj"] = new SerializableObject());

            checker.WriteAndReadWithTests(
                d => d.SelectSingleNode(@"CK-Structured/BugBinarySizeDiffer/p/data[@key=""Obj""]").Attributes["size"].Value = "1",
                dic => { dic.Ensure(uid1);  dic.Ensure(uid2); });

            Assert.That(checker.Errors.Count, Is.EqualTo(1));
            Assert.That(checker.Errors[0].HasError, Is.True);
        }