public void TestAddSingleAttributeFragments_ErrorIfDuplicateMember() { Expect.Call(template.HasMember("ExistingMember")).Return(true); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); Globals.AssertThrows(() => GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "id", "ExistingMember", false, template, renderFunction, context), (TemplateErrorException ex) => true); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_StyleInNonRootIsNotModified() { Expect.Call(docProcessor.ParseUntypedMarkup("width: 0px")).Return(new LiteralFragment("width: 0px")); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "style", "width: 0px", false, template, renderFunction, context); Assert.AreEqual(" style=\"width: 0px\"", ConcatenatedFragments); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_StyleInRootAppendsSemicolonIfNonLiteralFragmentIsReturned() { Expect.Call(docProcessor.ParseUntypedMarkup("code")).Return(new CodeExpressionFragment("code")); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "style", "code", true, template, renderFunction, context); Assert.AreEqual(" style=\"[EXPR:code];[Position]\"", ConcatenatedFragments); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_StyleInRootAppendsSemicolonIfOneIsMissing() { Expect.Call(docProcessor.ParseUntypedMarkup("width: 0px")).Return(new LiteralFragment("width: 0px")); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "style", "width: 0px", true, template, renderFunction, context); Assert.AreEqual(" style=\"width: 0px;[Position]\"", ConcatenatedFragments); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_SimpleNameValuePairWorks() { Expect.Call(docProcessor.ParseUntypedMarkup("test\"Value\"")).Return(new LiteralFragment("test"Value"")); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "testName", "test\"Value\"", false, template, renderFunction, context); Assert.AreEqual(" testName=\"test"Value"\"", ConcatenatedFragments); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_ActualNameWorks() { Expect.Call(docProcessor.ParseUntypedMarkup("SomeName")).Return(new LiteralFragment("SomeName")); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "actualName", "SomeName", false, template, renderFunction, context); Assert.AreEqual(" name=\"SomeName\"", ConcatenatedFragments); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_IdForNonRootElementWorks() { Expect.Call(template.HasMember("testid")).Return(false); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "id", "testid", false, template, renderFunction, context); Assert.AreEqual(" id=\"[ID]_testid\"", ConcatenatedFragments); Assert.AreEqual("testid", context.Id); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_TypeAttributeWorks() { SetupRepo(); Expect.Call(docProcessor.ParseUntypedMarkup("TestValue")).Return(new LiteralFragment("TestValue")); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "type", "TestValue", false, template, renderFunction, context); Assert.AreEqual(" type=\"TestValue\"", ConcatenatedFragments); Assert.AreEqual("TestValue", context.Type); mocks.VerifyAll(); }
public void TestAddSingleAttributeFragments_ForAndNameAttributesWorks() { foreach (var attrName in new[] { "for", "name" }) { SetupRepo(); mocks.ReplayAll(); var context = new GenericElementProcessorContext(); GenericElementProcessor.AddSingleAttributeFragments(docProcessor, attrName, "TestValue", false, template, renderFunction, context); Assert.AreEqual(" " + attrName + "=\"[ID]_TestValue\"", ConcatenatedFragments); mocks.VerifyAll(); } }
public void TestAddSingleAttributeFragments_IdForRootElementThrowsException() { var context = new GenericElementProcessorContext(); Globals.AssertThrows(() => GenericElementProcessor.AddSingleAttributeFragments(docProcessor, "id", "testid", true, template, renderFunction, context), (TemplateErrorException ex) => true); }