Web-site cacheable text templates loader
Inheritance: ITemplateFactory
Ejemplo n.º 1
0
		public void Load_WithCache_TemplateLoadedCorrectly()
		{
			// Assign
			var tf = new TemplateFactory(_environment.Object, _languageManagerProvider.Object, "en", true);

			// Act

			tf.Setup();
			var data = tf.Load("Foo.tpl");

			// Asset
			Assert.AreEqual("Dummy data", data.Get());

			// Assign

			tf = new TemplateFactory(_environment.Object, _languageManagerProvider.Object, "en", true);
			tf.Setup();
			Template.FileSystem = new Mock<IFileSystem>().Object;

			// Act
			data = tf.Load("Foo.tpl");

			// Assert
			Assert.AreEqual("Dummy data", data.Get());
		}
Ejemplo n.º 2
0
		public void Load_NullFileName_ArgumentNullExceptionThrown()
		{
			// Assign
			var tf = new TemplateFactory(_environment.Object, _languageManagerProvider.Object, "en");

			// Act
			tf.Setup();

			// Act & Assert
			Assert.Throws<ArgumentNullException>(() => tf.Load(null));
		}
Ejemplo n.º 3
0
		public void Load_NameWithoutTpl_TemplateLoadedCorrectly()
		{
			// Assign
			var tf = new TemplateFactory(_environment.Object, _languageManagerProvider.Object, "en");

			// Act

			tf.Setup();
			var data = tf.Load("Foo");

			// Assert
			Assert.AreEqual("Dummy data", data.Get());
		}
Ejemplo n.º 4
0
		public void Load_FromManifestEnabled_CalledCorrectlyPathFixedWithDots()
		{
			// Assign
			var tf = new TemplateFactory(_environment.Object, _languageManagerProvider.Object, "en", true, true);

			// Act

			tf.Setup();
			var result = tf.Load("Templates/Test.tpl");

			// Assert
			Assert.AreEqual("Hello!", result.Get());
		}