public static void ShouldBeCreateUriFromTypeExpressionFor(this TestAttributeNode attribute, string originalValue)
        {
            attribute.CodeNodes.ShouldHaveCount(1);
            string         createUriExpression = StubSyntaxProvider.GetTestCreateUriFromTypeExpression(originalValue);
            CodeExpression expectedExpression  = new CodeExpression(createUriExpression);

            attribute.CodeNodes.First().As <TestCodeExpressionNode>().CodeExpression.ShouldEqual(expectedExpression);
        }
Example #2
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"));
        }
        private void ThenOptionChildElementShouldHaveConditionalSelectAttributeFor(string resourceValueExpr)
        {
            var expected = new ConditionalExpression(StubSyntaxProvider.GetTestNulLCheckAndEvalFor(resourceValueExpr),
                                                     resourceValueExpr);
            IAttribute attribute = Context.ElementTarget.Elements.Cast <TestElement>().First().GetAttribute("selected");

            attribute.ShouldBe <TestAttributeNode>();
            attribute.As <TestAttributeNode>().ConditionalExpressionNodes.First().ConditionalExpression.ShouldEqual(expected);
        }
        public static void ShouldBeGetPropertyPathExpressionFor(this TestAttributeNode attribute, string originalValue)
        {
            CodeExpression expectedPropertyPathExpresion = new CodeExpression(StubSyntaxProvider.GetTestGetPropertyPathExpression(originalValue));

            attribute.CodeNodes.First().As <TestCodeExpressionNode>().CodeExpression.ShouldEqual(expectedPropertyPathExpresion);
        }
Example #5
0
        private void ThenNewAttributeShouldHaveConditionalNodeWithNullCheckFor(string value)
        {
            ConditionalExpression expected = new ConditionalExpression(StubSyntaxProvider.GetTestNulLCheckAndEvalFor(value), value);

            Context.NewAttribute.As <TestAttributeNode>().ConditionalExpressionNodes.Single().As <TestConditionalExpressionNode>().ConditionalExpression.ShouldEqual(expected);
        }