public void CollectionShouldCacheResults() { var element = new XElement("element", new XElement("elements1", new XElement("element1", "value1"))); CollectionAdapterStub adapter = new CollectionAdapterStub(element); adapter.SetInternalCacheOption(true); Assert.That(adapter.ElementCollectionRequired.Count(), Is.EqualTo(1)); element.Element("elements1").Add(new XElement("element1", "value1")); Assert.That(adapter.ElementCollectionRequired.Count(), Is.EqualTo(1)); }
public void ShouldThrowWhenCollectionOfAdaptedElementsIsNotKnown() { var element = new XElement("element", new XElement("elements2", new XElement("element2", "value2"))); CollectionAdapterStub adapter = new CollectionAdapterStub(element); Assert.Throws<ElementNotFoundException>(() => adapter.ElementCollectionRequired.Count()); }
public void ShouldBeAnEmptyCollectionWhenElementsIsNotKnownAndNotRequired() { var element = new XElement("element", new XElement("elements2", new XElement("element2", "value2"))); CollectionAdapterStub adapter = new CollectionAdapterStub(element); Assert.That(adapter.ElementCollectionNotRequired.Count(), Is.EqualTo(0)); }
public void ShouldBeAnEmptyCollectionWhenElementsIsEmpty() { var element = new XElement("element", new XElement("elements1")); CollectionAdapterStub adapter = new CollectionAdapterStub(element); Assert.That(adapter.ElementCollectionRequired.Count(), Is.EqualTo(0)); Assert.That(adapter.ElementCollectionNotRequired.Count(), Is.EqualTo(0)); }
public void ShouldBeACollectionOfAdaptedElements() { var element = new XElement("element", new XElement("elements1", new XElement("element1", "value1"))); CollectionAdapterStub adapter = new CollectionAdapterStub(element); Assert.That(adapter.ElementCollectionRequired.Count(), Is.EqualTo(1)); Assert.That(adapter.ElementCollectionRequired.First().Value, Is.EqualTo("value1")); }