예제 #1
0
        public void GetLayoutTemplate_WithFormTag_ReturnsCorrectHtmlString()
        {
            // Arrange
            var layoutTemplateBuilder = new DummyLayoutRenderer();

            SystemManager.RunWithHttpContext(
                this.context, 
                () =>
                    {
                        // Act
                        var htmlString = layoutTemplateBuilder.GetLayoutTemplate(string.Empty);

                        // Assert
                        Assert.IsTrue(htmlString.StartsWith(MasterPageDirective, StringComparison.Ordinal), "The master page directive is not added correctly.");
                        Assert.IsTrue(htmlString.Contains(layoutTemplateBuilder.InnerHtmlStringWithForm), "The method doesn't return the expected html.");
                    });
        }
예제 #2
0
        public void RenderViewToString_DummyController_ReturnsCorrectHtmlString()
        {
            // Arrange
            var layoutTemplateBuilder = new DummyLayoutRenderer();
            var dummyController = layoutTemplateBuilder.CreateController();

            Assert.IsNotNull(dummyController);

            // Act
            var htmlString = layoutTemplateBuilder.RenderViewToString(dummyController.ControllerContext, "Test");

            // Assert
            Assert.AreEqual(htmlString, layoutTemplateBuilder.InnerHtmlStringWithoutForm, "RenderViewToString method doesn't render the expected html.");
        }