Esempio n. 1
0
        public void SetTitle_AlreadyGotTitle_ThrowsInvalidOperationException()
        {
            // Arrange
            var context = new ErrorSummaryContext();

            context.SetTitle(attributes: null, content: new HtmlString("Existing title"));

            // Act
            var ex = Record.Exception(() => context.SetTitle(attributes: null, content: new HtmlString("Title")));

            // Assert
            Assert.IsType <InvalidOperationException>(ex);
            Assert.Equal("Only one <govuk-error-summary-title> element is permitted within each <govuk-error-summary>.", ex.Message);
        }
Esempio n. 2
0
        public void SetTitle_SetsTitleOnContext()
        {
            // Arrange
            var context = new ErrorSummaryContext();

            // Act
            context.SetTitle(attributes: null, content: new HtmlString("Title"));

            // Assert
            Assert.Equal("Title", context.Title?.Content?.RenderToString());
        }