Beispiel #1
0
        public void NamedPropertyForMultipleHitsShouldNotThrowWhenValueCachedIsNull()
        {
            var element = new XElement("element1",
                new XElement("property1"));

            var adapter = new NamedPropertyAdapterStub(element);
            adapter.SetInternalCacheOption(true);

            Assert.That(adapter.NamedPropertyNotRequired, Is.Null);
            Assert.That(adapter.NamedPropertyNotRequired, Is.Null);
        }
Beispiel #2
0
        public void NamedPropertyShouldCacheResults()
        {
            var element = new XElement("element1",
                new XElement("property1", "value1"));

            var adapter = new NamedPropertyAdapterStub(element);

            adapter.SetInternalCacheOption(true);

            Assert.That(adapter.NamedPropertyNotRequired, Is.EqualTo("value1"));

            element.Element("property1").SetValue("value2");

            Assert.That(adapter.NamedPropertyNotRequired, Is.EqualTo("value1"));
        }