コード例 #1
0
ファイル: BaseAdapterFixture.cs プロジェクト: pleb/Tank
        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));
        }
コード例 #2
0
ファイル: BaseAdapterFixture.cs プロジェクト: pleb/Tank
        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());
        }
コード例 #3
0
ファイル: BaseAdapterFixture.cs プロジェクト: pleb/Tank
        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));
        }
コード例 #4
0
ファイル: BaseAdapterFixture.cs プロジェクト: pleb/Tank
        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));
        }
コード例 #5
0
ファイル: BaseAdapterFixture.cs プロジェクト: pleb/Tank
        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"));
        }