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

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

                var viewModel = (JavaScriptViewModel)result.Model;

                Assert.AreEqual("test", viewModel.DesignModeContent);
            }
        }
        public void Index_ScriptGeneration_InlineCodeIsProvided()
        {
            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}</script>", Environment.NewLine);

                Assert.AreEqual(expectedScript, viewModel.JavaScriptCode);
            }
        }
        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);
            }
        }