Ejemplo n.º 1
0
        public void Index_ScriptGeneration_InlineCodeIsProvided()
        {
            using (var controller = new DummyEmbedCodeController())
            {
                string code = "<script>var inline = 5;</script>";

                controller.Model.InlineCode = code;

                var result = (ViewResult)controller.Index();

                var viewModel = (EmbedCodeViewModel)result.Model;

                Assert.AreEqual(code, viewModel.EmbedCode);
            }
        }
        public void Index_ScriptGeneration_InlineCodeIsProvided()
        {
            using (var controller = new DummyEmbedCodeController())
            {
                string code = "<script>var inline = 5;</script>";

                controller.Model.InlineCode = code;

                var result = (ViewResult)controller.Index();

                var viewModel = (EmbedCodeViewModel)result.Model;

                Assert.AreEqual(code, viewModel.EmbedCode);
            }
        }
Ejemplo n.º 3
0
        public void Index_DisplayDescription_IfInDesignMode()
        {
            using (var controller = new DummyEmbedCodeController(true))
            {
                string code = "<script>var inline = 5;</script>";

                string description = "provided description";

                controller.Model.InlineCode = code;

                controller.Model.Description = description;

                var result = (ViewResult)controller.Index();

                Assert.AreEqual(result.ViewBag.DesignModeContent, description);
            }
        }
        public void Index_DisplayDescription_IfInDesignMode()
        {
            using (var controller = new DummyEmbedCodeController(true))
            {
                string code = "<script>var inline = 5;</script>";

                string description = "provided description";

                controller.Model.InlineCode = code;

                controller.Model.Description = description;

                var result = (ViewResult)controller.Index();

                Assert.AreEqual(result.ViewBag.DesignModeContent, description);
            }
        }
Ejemplo n.º 5
0
        public void Index_CroppedTextIsDisplayed_In_Design_Mode()
        {
            using (var controller = new DummyEmbedCodeController(string.Empty, true))
            {
                var sb = new StringBuilder();
                sb.Append("<script>")
                .AppendLine()
                .Append("var inline = 5;")
                .AppendLine()
                .Append("</script>");

                string code = sb.ToString();

                controller.Model.InlineCode = code;

                var result = (ViewResult)controller.Index();

                Assert.AreEqual(result.ViewBag.DesignModeContent, "<script>\r\nvar inline = 5;\r\n...\r\n");
            }
        }
        public void Index_CroppedTextIsDisplayed_In_Design_Mode()
        {
            using (var controller = new DummyEmbedCodeController(string.Empty, true))
            {
                var sb = new StringBuilder();
                sb.Append("<script>")
                  .AppendLine()
                  .Append("var inline = 5;")
                  .AppendLine()
                  .Append("</script>");

                string code = sb.ToString();

                controller.Model.InlineCode = code;

                var result = (ViewResult)controller.Index();

                Assert.AreEqual(result.ViewBag.DesignModeContent, "<script>\r\nvar inline = 5;\r\n...\r\n");
            }
        }
Ejemplo n.º 7
0
        public void Index_TestDescriptionIsNotDisplayed_IfNotInDesignMode()
        {
            using (var controller = new DummyEmbedCodeController())
            {
                string code = "<script>var inline = 5;</script>";

                string description = "provided description";

                controller.Model.InlineCode = code;

                controller.Model.Description = description;

                var result = (ViewResult)controller.Index();

                Assert.IsNull(result.ViewBag.DesignModeContent);

                var viewModel = (EmbedCodeViewModel)result.Model;

                Assert.AreEqual(code, viewModel.EmbedCode);
            }
        }
        public void Index_TestDescriptionIsNotDisplayed_IfNotInDesignMode()
        {
            using (var controller = new DummyEmbedCodeController())
            {
                string code = "<script>var inline = 5;</script>";

                string description = "provided description";

                controller.Model.InlineCode = code;

                controller.Model.Description = description;

                var result = (ViewResult)controller.Index();

                Assert.IsNull(result.ViewBag.DesignModeContent);

                var viewModel = (EmbedCodeViewModel)result.Model;

                Assert.AreEqual(code, viewModel.EmbedCode);
            }
        }