Inheritance: ITemplateFactory
Example #1
0
        public void Create_WithFilePath_GetsFileTemplate()
        {
            // Arrange
            var reader = new Mock<IFileReader>(); reader.Setup(x => x.Exists(It.IsAny<string>())).Returns(true);
            var factory = new TemplateFactory(reader.Object, Assembly.GetExecutingAssembly());

            // Act
            var result = factory.Create("C:\\files\template.html");

            // Assert
            Assert.That(result, Is.InstanceOf<FileTemplate>());
        }
Example #2
0
        public void Create_WithString_GetsStringTemplate()
        {
            // Arrange
            var reader = new Mock<IFileReader>();
            var factory = new TemplateFactory(reader.Object, Assembly.GetExecutingAssembly());

            // Act
            var result = factory.Create("This is a plain string template.");

            // Assert
            Assert.That(result, Is.InstanceOf<StringTemplate>());
        }
Example #3
0
        public void Create_WithEmbeddedResourceString_GetsEmbeddedResourceTemplate()
        {
            // Arrange
            var reader = new Mock<IFileReader>();
            var factory = new TemplateFactory(reader.Object, Assembly.GetExecutingAssembly());

            // Act
            var result = factory.Create("Resources.Test.html");

            // Assert
            Assert.That(result, Is.InstanceOf<EmbeddedResourceTemplate>());
        }