Esempio n. 1
0
        public void ThrowIfStagesIncomplete_StageAtNoneThrowsInvalidOperationException()
        {
            // Arrange
            var ctx = new DetailsContext();

            // Act & Assert
            Assert.Equal(DetailsRenderStage.None, ctx.RenderStage);
            var ex = Assert.Throws <InvalidOperationException>(() => ctx.ThrowIfStagesIncomplete());

            Assert.Equal("Missing one or more child elements.", ex.Message);
        }
Esempio n. 2
0
        public void ThrowIfStagesIncomplete_StageAtTextDoesNotThrow()
        {
            // Arrange
            var ctx = new DetailsContext();

            ctx.SetSummary(attributes: null, new HtmlString("Summary"));
            ctx.SetText(attributes: null, new HtmlString("Text"));

            // Act & Assert
            Assert.Equal(DetailsRenderStage.Text, ctx.RenderStage);
            ctx.ThrowIfStagesIncomplete();
        }
Esempio n. 3
0
        public void ThrowIfStagesIncomplete_StageAtSummaryThrowsInvalidOperationException()
        {
            // Arrange
            var ctx = new DetailsContext();

            ctx.SetSummary(attributes: null, new HtmlString("Summary"));

            // Act & Assert
            Assert.Equal(DetailsRenderStage.Summary, ctx.RenderStage);
            var ex = Assert.Throws <InvalidOperationException>(() => ctx.ThrowIfStagesIncomplete());

            Assert.Equal("Missing one or more child elements.", ex.Message);
        }