public void Index_DescriptionIsPassedToView()
        {
            using (var controller = new DummyJavaScriptController())
            {
                controller.Model.InlineCode  = "not empty";
                controller.Model.Description = "test";

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

                var viewModel = (JavaScriptViewModel)result.Model;

                Assert.AreEqual("test", viewModel.DesignModeContent);
            }
        }
        public void Index_ScriptGeneration_FileUrlIsProvided()
        {
            using (var controller = new DummyJavaScriptController())
            {
                controller.Model.Mode = ResourceMode.Reference;

                controller.Model.FileUrl = "~/test.js";

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

                var viewModel = (JavaScriptViewModel)result.Model;

                var expectedScript = @"<script type=""text/javascript"" src=""/test.js""></script>";

                Assert.AreEqual(expectedScript, viewModel.JavaScriptCode);
            }
        }
        public void Index_ScriptGeneration_ShortInlineCodeIsProvided()
        {
            using (var controller = new DummyJavaScriptController())
            {
                controller.Model.Mode = ResourceMode.Inline;

                controller.Model.InlineCode = "var inline = 5;";

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

                var viewModel = (JavaScriptViewModel)result.Model;

                var expectedScript = string.Format(@"<script type=""text/javascript"">{0}var inline = 5;{0}...{0}", Environment.NewLine);

                Assert.AreEqual(expectedScript, viewModel.DesignModeContent);
            }
        }