Exemplo 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);
        }
Exemplo 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();
        }
Exemplo 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);
        }