<commit_before>// Copyright 2004-2007 Castle Project - http://www.castleproject.org/
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests
{
	using System;
	using System.IO;
	using System.Collections;
	using System.ComponentModel;

	using NUnit.Framework;


	[TestFixture]
	public class NVelocityTestCase
	{
		[Test]
		public void SimpleTemplateProcessing()
		{
			String path = Path.Combine(
				AppDomain.CurrentDomain.BaseDirectory, 
#if DOTNET2
			Path.Combine(System.Configuration.ConfigurationManager.AppSettings["tests.src"], "templates"));
#else
			Path.Combine(System.Configuration.ConfigurationSettings.AppSettings["tests.src"], "templates"));
#endif

			ITemplateEngine engine = new NVelocityTemplateEngine(path);
			(engine as ISupportInitialize).BeginInit();

			StringWriter writer = new StringWriter();

			Assert.IsTrue( engine.Process(new Hashtable(), "simple.vm", writer) );

			Assert.AreEqual("This is a simple template", writer.GetStringBuilder().ToString());
		}

		[Test]
		public void SimpleTemplateProcessingWithinResource()
		{
			NVelocityTemplateEngine engine = new NVelocityTemplateEngine();

			engine.AddResourceAssembly("Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests");
			
			(engine as ISupportInitialize).BeginInit();

			StringWriter writer = new StringWriter();

			string templateFile = "Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests/compiledres/simple.vm";
			Assert.IsTrue( engine.Process(
				new Hashtable(), 
				templateFile, 
				writer) );

			Assert.AreEqual("This is a simple template", writer.GetStringBuilder().ToString());
		}


		[Test]
		public void SimpleTemplateProcessingWithinTwoResources()
		{
			NVelocityTemplateEngine engine = new NVelocityTemplateEngine();

			engine.AddResourceAssembly("Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests");
			engine.AddResourceAssembly("Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests.SR");

			(engine as ISupportInitialize).BeginInit();

			StringWriter writer = new StringWriter();

			string templateFile = "Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests/compiledres/simple.vm";
			Assert.IsTrue(engine.Process(
				new Hashtable(),
				templateFile,
				writer));

			Assert.AreEqual("This is a simple template", writer.GetStringBuilder().ToString());

			// clear the writer for the second run
			writer = new StringWriter();
			
			string secondTemplateFile = "Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests.SecondResourceDll/compiledres/simple.vm";
			Assert.IsTrue(engine.Process(
				new Hashtable(),
				secondTemplateFile,
				writer));
			
			Assert.AreEqual("This is the second simple template", writer.GetStringBuilder().ToString());
			
		}
		
		
		
	}
}
<commit_msg>Applied patch from <NAME>, fixing a missed a string literal relating to the SecondResourceDLL in the NVelocityTemplateViewEngine.Test.<commit_after>// Copyright 2004-2007 Castle Project - http://www.castleproject.org/
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests
{
	using System;
	using System.IO;
	using System.Collections;
	using System.ComponentModel;

	using NUnit.Framework;


	[TestFixture]
	public class NVelocityTestCase
	{
		[Test]
		public void SimpleTemplateProcessing()
		{
			String path = Path.Combine(
				AppDomain.CurrentDomain.BaseDirectory, 
#if DOTNET2
			Path.Combine(System.Configuration.ConfigurationManager.AppSettings["tests.src"], "templates"));
#else
			Path.Combine(System.Configuration.ConfigurationSettings.AppSettings["tests.src"], "templates"));
#endif

			ITemplateEngine engine = new NVelocityTemplateEngine(path);
			(engine as ISupportInitialize).BeginInit();

			StringWriter writer = new StringWriter();

			Assert.IsTrue( engine.Process(new Hashtable(), "simple.vm", writer) );

			Assert.AreEqual("This is a simple template", writer.GetStringBuilder().ToString());
		}

		[Test]
		public void SimpleTemplateProcessingWithinResource()
		{
			NVelocityTemplateEngine engine = new NVelocityTemplateEngine();

			engine.AddResourceAssembly("Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests");
			
			(engine as ISupportInitialize).BeginInit();

			StringWriter writer = new StringWriter();

			string templateFile = "Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests/compiledres/simple.vm";
			Assert.IsTrue( engine.Process(
				new Hashtable(), 
				templateFile, 
				writer) );

			Assert.AreEqual("This is a simple template", writer.GetStringBuilder().ToString());
		}


		[Test]
		public void SimpleTemplateProcessingWithinTwoResources()
		{
			NVelocityTemplateEngine engine = new NVelocityTemplateEngine();

			engine.AddResourceAssembly("Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests");
			engine.AddResourceAssembly("Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests.SR");

			(engine as ISupportInitialize).BeginInit();

			StringWriter writer = new StringWriter();

			string templateFile = "Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests/compiledres/simple.vm";
			Assert.IsTrue(engine.Process(
				new Hashtable(),
				templateFile,
				writer));

			Assert.AreEqual("This is a simple template", writer.GetStringBuilder().ToString());

			// clear the writer for the second run
			writer = new StringWriter();
			
			string secondTemplateFile = "Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine.Tests.SR/compiledres/simple.vm"; 
			Assert.IsTrue(engine.Process(
				new Hashtable(),
				secondTemplateFile,
				writer));
			
			Assert.AreEqual("This is the second simple template", writer.GetStringBuilder().ToString());
			
		}
		
		
		
	}
}

{'fraction_non_alphanumeric': 0.10423594043660546, 'fraction_numerical': 0.003758854994940003, 'mean_word_length': 4.561093247588424, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7156860', 'n_tokens_mistral': 2114, 'n_tokens_neox': 1837, 'n_words': 466}