public void TransformCallsEachAction()
        {
            TestElement element = InternalTestNodes.TestElement("fred");

            GivenATransformerWithActions(element, MockRepository.GenerateStub <IElementTransformerAction>(), MockRepository.GenerateStub <IElementTransformerAction>());
            WhenTransformIsCalledForElement(element);
            EachActionIsExecutedWithElement(element);
        }
        public void TransformReturnsTheElement()
        {
            TestElement element = InternalTestNodes.TestElement("fred");

            GivenATransformerWithActions(element);
            WhenTransformIsCalledForElement(element);
            ThenTheResultIs(element);
        }
Пример #3
0
        public void ShouldRemoveInnerText()
        {
            TestElement element = InternalTestNodes.TestElement("foo").WithAttribute("for", "resource.Stuff");

            element.AddTextElement("this is the inner text");
            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenThenElementShouldContainNoInnerTextNodes();
        }
Пример #4
0
        public void ShouldNotReplaceInnerTextIfHasNoForAttribute()
        {
            TestElement element = InternalTestNodes.TestElement("foo");

            element.AddTextElement("this is the inner text");
            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenTheInnerTextShouldBe("this is the inner text");
        }
Пример #5
0
        public void ShouldAddInnerTextWithResourceExpression()
        {
            TestElement element = InternalTestNodes.TestElement("foo").WithAttribute("for", "resource.Stuff");

            element.AddTextElement("this is the inner text");
            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenThenElementShouldContainConditional("resource.Stuff", StubSyntaxProvider.GetTestNullCheckExpression("resource"));
        }
        public void ShouldNotAddToAttributeIfTheFromAttributeDoesntExist()
        {
            TestElement element = InternalTestNodes.TestElement("").WithAttribute("NOTTHEFROMATTRIBUTE", "aValue");

            GivenToAndFromAttributes("to", "from");
            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenAttributeWithNameIsNotInserted("to");
        }
        public void ShouldAddAnAttributeOfTheSpecifiedNameWhenActionIsCalledAndFromAttributeExists()
        {
            TestElement element = InternalTestNodes.TestElement("").WithAttribute("from", "aValue");

            GivenToAndFromAttributes("to", "from");
            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenAttributeIsInsertedWithName("to");
        }
        public void ShouldNotRemoveOriginalAttribute()
        {
            TestElement element = InternalTestNodes.TestElement("").WithAttribute("from", "aValue");

            GivenToAndFromAttributes("to", "from");
            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenAttributeIsStillPresent("from");
        }
        public void ShouldCallAttributeModiferToTransformAttributeToTheNewValue()
        {
            TestElement element = InternalTestNodes.TestElement("").WithAttribute("from", "aValue");

            GivenToAndFromAttributes("to", "from");
            IAttribute originalAttribute = element.GetAttribute("from");

            GivenElementTarget(element);
            WhenActionCalledOnElement();
            ThenHasCalledModiferWithAttributes(originalAttribute, element.GetAttribute("to"));
        }