Пример #1
0
        public void SetDescription_AlreadyGotDescription_ThrowsInvalidOperationException()
        {
            // Arrange
            var context = new ErrorSummaryContext();

            context.SetDescription(attributes: null, content: new HtmlString("Existing description"));

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

            // Assert
            Assert.IsType <InvalidOperationException>(ex);
            Assert.Equal("Only one <govuk-error-summary-description> element is permitted within each <govuk-error-summary>.", ex.Message);
        }
Пример #2
0
        public void SetDescription_SetsDescriptionOnContext()
        {
            // Arrange
            var context = new ErrorSummaryContext();

            // Act
            context.SetDescription(attributes: null, content: new HtmlString("Description"));

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