Inheritance: IHttpHandler
        //[Test][Ignore("Race condition when running in paralell with other tests")]
        public void serverCode_defaultValues_and_EmptyRequest()
        {
            var scriptCombiner = new ScriptCombiner();
            scriptCombiner.ProcessRequest(null);

            Assert.AreEqual	(scriptCombiner.setName,string.Empty , "[empty request] setName");
            Assert.AreEqual	(scriptCombiner.version,string.Empty , "[empty request] version");
            Assert.IsNotNull(ScriptCombiner.mappingsLocation	 , "[empty request] mappingsLocation");

            var responseHtml = context.response_Read_All();
            Assert.AreEqual(EMPTY_RESPONSE,responseHtml, "[empty request] responseHtml should be empty");

            request.QueryString["s"] = "setName";
            request.QueryString["v"] = "version";
            scriptCombiner.ProcessRequest(null);
            Assert.AreEqual(scriptCombiner.setName,"setName", "setName value");
            Assert.AreEqual(scriptCombiner.version,"version", "setName value");

            //test test handshake
            request.QueryString["Hello"] = "TM";
            scriptCombiner.ProcessRequest(null);
            responseHtml = context.response_Read_All();
            Assert.AreEqual(responseHtml, "Good Morning", "handshake");
        }
        public void serverCode_minifyCodeSetting()
        {
            var scriptCombiner = new ScriptCombiner();

            scriptCombiner.ProcessRequest(null);
            Assert.IsTrue(scriptCombiner.minifyCode, "minifyCode should be true");

            request.QueryString["s"] = "someValue";
            request.QueryString["dontMinify"] = "true";
            scriptCombiner.ProcessRequest(null);
            Assert.IsFalse(scriptCombiner.minifyCode, "minifyCode should be false");
        }
        public void serverCode_makeRequestFor_one_JavascriptFile()
        {
            var scriptCombiner = new ScriptCombiner();
            scriptCombiner.ignoreCache = true;
            ScriptCombiner.mappingsLocation = "{0}.txt";

            var fileContents = "var a=1; // a test js file";
            var expectedResult = "\nvar a=1;";
            var file1 = "a.js";
            var mappingName = "testMapping";

            var mappingFile = file1.saveAs(this.BaseDir.pathCombine(mappingName + ".txt"));
            var jsFile = fileContents.saveAs(this.BaseDir.pathCombine("a.js"));

            Assert.That(mappingFile.fileExists() && mappingFile.fileContents()  == file1, "mappingFile not OK");
            Assert.That(jsFile.fileExists() 	 && jsFile.fileContents() 		== fileContents, "mappingFile not OK");

            request.QueryString["s"] = mappingName;
            scriptCombiner.ProcessRequest(null);

            var responseText = context.response_Read_All();
            Assert.AreEqual(expectedResult					, responseText	, "responseText != expectedResult");
            Assert.AreEqual(scriptCombiner.filesProcessed[0], file1			, "scriptCombiner.filesProcessed[0]");

            // these two fails due to weird encoding bug (the text is the same (in ascii))
            //Assert.AreEqual(scriptCombiner.minifiedCode		, expectedResult, "minifiedCode");
            //Assert.AreEqual(scriptCombiner.allScripts.str() , fileContents  , "allScripts");
        }
        public void serverCode_makeRequestFor_two_JavascriptFile()
        {
            var scriptCombiner = new ScriptCombiner();
            scriptCombiner.ignoreCache = true;
            ScriptCombiner.mappingsLocation = "{0}.txt";

            var fileContents1 = "var a=1; // a test js file";
            var fileContents2 = "var b=1; // a test js file";
            var expectedResult = "\nvar a=1;var b=1;";
            var file1 = "a.js";
            var file2 = "b.js";
            var mappingName = "testMapping";
            var mappingContents = file1.line() + file2.line();

            mappingContents.saveAs(this.BaseDir.pathCombine(mappingName + ".txt"));
            fileContents1.saveAs(this.BaseDir.pathCombine(file1));
            fileContents2.saveAs(this.BaseDir.pathCombine(file2));

            request.QueryString["s"] = mappingName;
            scriptCombiner.ProcessRequest(null);

            var responseText = context.response_Read_All();
            Assert.AreEqual(expectedResult,responseText, "responseText != expectedResult");
        }
		/// <summary>
		/// Combines a code of script assets
		/// </summary>
		/// <param name="assets">Set of script assets</param>
		/// <param name="bundleVirtualPath">Virtual path of bundle</param>
		/// <param name="isDebugMode">Flag that web application is in debug mode</param>
		/// /// <returns>Combined asset</returns>
		protected override IAsset Combine(IList<IAsset> assets, string bundleVirtualPath, bool isDebugMode)
		{
			var scriptCombiner = new ScriptCombiner
			{
				IsDebugMode = isDebugMode,
				EnableTracing = EnableTracing
			};

			IAsset combinedAsset = scriptCombiner.Combine(assets, bundleVirtualPath);

			return combinedAsset;
		}