public async Task ProcessAsync_RowAlreadyHasValueThrowsInvalidOperationException() { // Arrange var summaryListContext = new SummaryListContext(); var rowContext = new SummaryListRowContext(); rowContext.TrySetValue(new HtmlString("Existing value")); var context = new TagHelperContext( tagName: "govuk-summary-list-row-value", allAttributes: new TagHelperAttributeList(), items: new Dictionary <object, object>() { { typeof(SummaryListContext), summaryListContext }, { typeof(SummaryListRowContext), rowContext } }, uniqueId: "test"); var output = new TagHelperOutput( "govuk-summary-list-row-value", attributes: new TagHelperAttributeList(), getChildContentAsync: (useCachedResult, encoder) => { var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetContent("Value content"); return(Task.FromResult <TagHelperContent>(tagHelperContent)); }); var tagHelper = new SummaryListRowValueTagHelper(); // Act & Assert var ex = await Assert.ThrowsAsync <InvalidOperationException>(() => tagHelper.ProcessAsync(context, output)); Assert.Equal("Cannot render <govuk-summary-list-row-value> here.", ex.Message); }