diff --git a/.gitignore b/.gitignore
index f99f44b..708828b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,4 +36,7 @@ obj
# Styles Generated Code
*.scss.ts
-**/*.DotSettings.user
\ No newline at end of file
+**/*.DotSettings.user
+
+# JetBrains
+.idea
\ No newline at end of file
diff --git a/AzureLiquid.Tests/Arrangement.cs b/AzureLiquid.Tests/Arrangement.cs
new file mode 100644
index 0000000..ba7c7e1
--- /dev/null
+++ b/AzureLiquid.Tests/Arrangement.cs
@@ -0,0 +1,77 @@
+//
+// Licensed under the open source Apache License, Version 2.0.
+// Project: AzureLiquid.Tests
+// Created: 2022-10-18 07:46
+//
+
+using AzureLiquid.Tests.Resources;
+
+namespace AzureLiquid.Tests;
+
+///
+/// Contains arranged values used for testing, containing mock instances and expected return values.
+///
+public class Arrangement
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Arrangement()
+ {
+ Basic = new BasicObject("John Doe");
+ Deep = new TemplateFact
+ {
+ Content = new DeepObject("Jane Doe"),
+ Template = "{{content.nested.title}}
",
+ Expected = "Jane Doe
"
+ };
+
+ var simple = "Simple Template";
+ SimpleTemplate = new TemplateFact
+ {
+ Content = new BasicObject(simple),
+ Template = Templates.SimpleTemplate,
+ Expected = Templates.SimpleResult
+ };
+
+ Event = new TemplateFact
+ {
+ Content = Templates.EventContent,
+ Template = Templates.EventTemplate,
+ Expected = Templates.EventResult
+ };
+
+ Albums = new TemplateFact
+ {
+ Content = Templates.AlbumsContent,
+ Template = Templates.AlbumsTemplate,
+ Expected = Templates.AlbumsResult
+ };
+ }
+
+ ///
+ /// Gets the albums fact.
+ ///
+ public TemplateFact Albums { get; }
+
+ ///
+ /// Gets the event fact.
+ ///
+ public TemplateFact Event { get; }
+
+ ///
+ /// Gets the simple template fact.
+ ///
+ public TemplateFact SimpleTemplate { get; }
+
+ ///
+ /// Gets the deep object fact.
+ ///
+ public TemplateFact Deep { get; }
+
+ ///
+ /// Gets the basic object fact.
+ ///
+ public BasicObject Basic { get; }
+
+}
diff --git a/AzureLiquid.Tests/BasicObject.cs b/AzureLiquid.Tests/BasicObject.cs
new file mode 100644
index 0000000..28f026e
--- /dev/null
+++ b/AzureLiquid.Tests/BasicObject.cs
@@ -0,0 +1,25 @@
+//
+// Licensed under the open source Apache License, Version 2.0.
+// Project: AzureLiquid.Tests
+// Created: 2022-10-18 07:46
+//
+
+namespace AzureLiquid.Tests;
+
+///
+/// Basic test of an object to serialize and render.
+///
+///
+/// Initializes a new instance of the class.
+///
+/// The title.
+public class BasicObject(string title)
+{
+ ///
+ /// Gets the title.
+ ///
+ ///
+ /// The title.
+ ///
+ public string Title { get; } = title;
+}
diff --git a/AzureLiquid.Tests/DeepObject.cs b/AzureLiquid.Tests/DeepObject.cs
new file mode 100644
index 0000000..e7bf230
--- /dev/null
+++ b/AzureLiquid.Tests/DeepObject.cs
@@ -0,0 +1,25 @@
+//
+// Licensed under the open source Apache License, Version 2.0.
+// Project: AzureLiquid.Tests
+// Created: 2022-10-18 07:46
+//
+
+namespace AzureLiquid.Tests;
+
+///
+/// Test sample for an object with nested types, ensure that deeper accessors are valid.
+///
+///
+/// Initializes a new instance of the class.
+///
+/// The title.
+public class DeepObject(string title)
+{
+ ///
+ /// Gets the nested object.
+ ///
+ ///
+ /// The nested object.
+ ///
+ public BasicObject Nested { get; } = new BasicObject(title);
+}
diff --git a/AzureLiquid.Tests/LiquidParserTests.Arrangement.cs b/AzureLiquid.Tests/LiquidParserTests.Arrangement.cs
deleted file mode 100644
index abd2040..0000000
--- a/AzureLiquid.Tests/LiquidParserTests.Arrangement.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-//
-// Licensed under the open source Apache License, Version 2.0.
-// Project: AzureLiquid.Tests
-// Created: 2022-10-18 07:46
-//
-
-using AzureLiquid.Tests.Resources;
-
-namespace AzureLiquid.Tests
-{
- public partial class LiquidParserTests
- {
- ///
- /// Contains arranged values used for testing, containing mock instances and expected return values.
- ///
- private class Arrangement
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public Arrangement()
- {
- Basic = new BasicObject("John Doe");
- Deep = new TemplateFact
- {
- Content = new DeepObject("Jane Doe"),
- Template = "{{content.nested.title}}
",
- Expected = "Jane Doe
"
- };
-
- var simple = "Simple Template";
- SimpleTemplate = new TemplateFact
- {
- Content = new BasicObject(simple),
- Template = Templates.SimpleTemplate,
- Expected = Templates.SimpleResult
- };
-
- Event = new TemplateFact
- {
- Content = Templates.EventContent,
- Template = Templates.EventTemplate,
- Expected = Templates.EventResult
- };
-
- Albums = new TemplateFact
- {
- Content = Templates.AlbumsContent,
- Template = Templates.AlbumsTemplate,
- Expected = Templates.AlbumsResult
- };
- }
-
- ///
- /// Gets the albums fact.
- ///
- public TemplateFact Albums { get; }
-
- ///
- /// Gets the event fact.
- ///
- public TemplateFact Event { get; }
-
- ///
- /// Gets the simple template fact.
- ///
- public TemplateFact SimpleTemplate { get; }
-
- ///
- /// Gets the deep object fact.
- ///
- public TemplateFact Deep { get; }
-
- ///
- /// Gets the basic object fact.
- ///
- public BasicObject Basic { get; }
-
- ///
- /// Basic test of an object to serialize and render.
- ///
- public class BasicObject
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The title.
- public BasicObject(string title)
- {
- Title = title;
- }
-
- ///
- /// Gets or sets the title.
- ///
- ///
- /// The title.
- ///
- public string Title { get; }
- }
-
- ///
- /// Test sample for an object with nested types, ensure that deeper accessors are valid.
- ///
- public class DeepObject
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The title.
- public DeepObject(string title)
- {
- Nested = new BasicObject(title);
- }
-
- // ReSharper disable once UnusedAutoPropertyAccessor.Local // used in serialization
- // ReSharper disable once MemberCanBePrivate.Local // used in serialization
- ///
- /// Gets the nested object.
- ///
- ///
- /// The nested object.
- ///
- public BasicObject Nested { get; }
- }
- }
-
- ///
- /// A fact check for a rendered template, with data content and expected result.
- ///
- ///
- private class TemplateFact
- {
- ///
- /// Gets or sets the template.
- ///
- ///
- /// The template.
- ///
- public string? Template { get; set; }
-
- ///
- /// Gets or sets the expected result.
- ///
- ///
- /// The expected result.
- ///
- public string? Expected { get; set; }
-
- ///
- /// Gets or sets the content.
- ///
- ///
- /// The content.
- ///
- public T? Content { get; set; }
- }
- }
-}
\ No newline at end of file
diff --git a/AzureLiquid.Tests/LiquidParserTests.cs b/AzureLiquid.Tests/LiquidParserTests.cs
index 66bbdb6..0e48941 100644
--- a/AzureLiquid.Tests/LiquidParserTests.cs
+++ b/AzureLiquid.Tests/LiquidParserTests.cs
@@ -5,149 +5,113 @@
//
using System.Text.RegularExpressions;
-using AzureLiquid.Tests.Resources;
using FluentAssertions;
using Xunit;
-namespace AzureLiquid.Tests
+namespace AzureLiquid.Tests;
+
+///
+/// Test fixture for verifying the class.
+///
+public class LiquidParserTests
{
///
- /// Test fixture for verifying the class.
+ /// Ensures the basic parsing works from a simple object.
///
- public partial class LiquidParserTests
+ [Fact]
+ public void EnsureBasicParsing()
{
- ///
- /// Compares two text snippets but ignores differences in whitespace.
- ///
- /// The first text.
- /// The second text.
- /// true if the texts match, otherwise false.
- private static bool CompareTextsNoWhitespace(string text1, string text2)
- {
- var spaces = new Regex(@"[\s]*");
- return string.CompareOrdinal(spaces.Replace(text1, string.Empty), spaces.Replace(text2, string.Empty)) == 0;
- }
+ // Arrange
+ var arrangement = new Arrangement();
+
+ // Act
+ var result = new LiquidParser()
+ .SetContent(arrangement.Basic, true)
+ .Parse("{{ content.title | Prepend: \"Page title - \" }}")
+ .Render();
+
+ // Assert
+ result.Should().NotBeEmpty("A result should have been returned");
+ result.Should().Be("Page title - " + arrangement.Basic.Title, "The expected result should be returned");
+ }
- ///
- /// Ensures the basic parsing works from a simple object.
- ///
- [Fact]
- public void EnsureBasicParsing()
- {
- // Arrange
- var arrangement = new Arrangement();
-
- // Act
- var result = new LiquidParser()
- .SetContent(arrangement.Basic, true)
- .Parse("{{ content.title | Prepend: \"Page title - \" }}")
- .Render();
-
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- result.Should().Be("Page title - " + arrangement.Basic.Title, "The expected result should be returned");
- }
+ ///
+ /// Ensures the deep parsing works with nested objects.
+ ///
+ [Fact]
+ public void EnsureDeepParsing() => Arrange(new Arrangement().Deep, true);
- ///
- /// Ensures the deep parsing works with nested objects.
- ///
- [Fact]
- public void EnsureDeepParsing()
- {
- // Arrange
- var arrangement = new Arrangement().Deep;
-
- // Act
- var result = new LiquidParser()
- .SetContent(arrangement.Content, true)
- .Parse(arrangement.Template)
- .Render();
-
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- result.Should().Be(arrangement.Expected, "The expected result should be returned");
- }
+ ///
+ /// Ensures the template parsing works when using a liquid file.
+ ///
+ [Fact]
+ public void EnsureTemplateParsing() => Arrange(new Arrangement().SimpleTemplate);
- ///
- /// Ensures the template parsing works when using a liquid file.
- ///
- [Fact]
- public void EnsureTemplateParsing()
- {
- // Arrange
- var arrangement = new Arrangement().SimpleTemplate;
-
- // Act
- var result = new LiquidParser()
- .SetContent(arrangement.Content)
- .Parse(arrangement.Template)
- .Render();
-
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- result.Should().Be(arrangement.Expected, "The expected result should be returned");
- }
+ ///
+ /// Ensures loading JSON from a file and parsing with a liquid file template works.
+ ///
+ [Fact]
+ public void EnsureJsonBodyTemplateParsing() => Arrange(new Arrangement().Event);
- ///
- /// Ensures loading JSON from a file and parsing with a liquid file template works.
- ///
- [Fact]
- public void EnsureJsonBodyTemplateParsing()
- {
- // Arrange
- var arrangement = new Arrangement().Event;
-
- // Act
- var result = new LiquidParser()
- .SetContentJson(arrangement.Content!)
- .Parse(arrangement.Template)
- .Render();
-
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- CompareTextsNoWhitespace(result, arrangement.Expected!).Should()
- .BeTrue("The expected result should be returned");
- }
+ ///
+ /// Compares two text snippets but ignores differences in whitespace.
+ ///
+ /// The first text.
+ /// The second text.
+ /// true if the texts match, otherwise false.
+ private static bool CompareTextsNoWhitespace(string text1, string text2)
+ {
+ var spaces = new Regex(@"[\s]*");
+ return string.CompareOrdinal(spaces.Replace(text1, string.Empty), spaces.Replace(text2, string.Empty)) == 0;
+ }
- [Fact]
- public void EnsureXmlStringParsing()
+ ///
+ /// Creates a instance with the specified template fact.
+ ///
+ /// The type of the template fact content.
+ /// The template fact to use.
+ /// Whether to force camel case on the content.
+ private static LiquidParser CreateParser(TemplateFact fact, bool forceCamelCase = false)
+ {
+ var parser = new LiquidParser();
+
+ if (fact.Content is string content)
{
- // Arrange
- var arrangement = new Arrangement().Albums;
-
- // Act
- var result = new LiquidParser()
- .SetContentXml(arrangement.Content!)
- .Parse(arrangement.Template)
- .Render();
-
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- CompareTextsNoWhitespace(result, arrangement.Expected!).Should()
- .BeTrue("The expected result should be returned");
+ if (content!.Contains("
- {
- Content = Templates.Append100Content,
- Template = Templates.AppendTemplate,
- Expected = Templates.Append100Expected
- };
-
- // Act
- var result = new LiquidParser()
- .SetContentJson(arrangement.Content!)
- .Parse(arrangement.Template)
- .Render();
-
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- CompareTextsNoWhitespace(result, arrangement.Expected!).Should()
- .BeTrue("The expected result should be returned");
+ parser.SetContent(fact.Content, forceCamelCase);
}
+
+ return parser;
+ }
+
+ ///
+ /// Ensures loading XML or JSON from a file and parsing with a liquid file template works.
+ ///
+ /// The type of the template fact content.
+ /// The template fact to test.
+ /// Whether to force camel case on the content.
+ private static void Arrange(TemplateFact fact, bool forceCamelCase = false)
+ {
+ // Arrange
+ var parser = CreateParser(fact, forceCamelCase);
+
+ // Act
+ var result = parser.Parse(fact.Template).Render();
+
+ // Assert
+ result.Should().NotBeEmpty("A result should have been returned");
+ CompareTextsNoWhitespace(result, fact.Expected!.ToString()).Should()
+ .BeTrue("The expected result should be returned");
}
-}
\ No newline at end of file
+}
diff --git a/AzureLiquid.Tests/PreviewProcessTests.cs b/AzureLiquid.Tests/PreviewProcessTests.cs
index f529dda..f8c0869 100644
--- a/AzureLiquid.Tests/PreviewProcessTests.cs
+++ b/AzureLiquid.Tests/PreviewProcessTests.cs
@@ -10,211 +10,210 @@
using FluentAssertions;
using Xunit;
-namespace AzureLiquid.Tests
+namespace AzureLiquid.Tests;
+
+///
+/// Test fixture for verifying the class.
+///
+public class PreviewProcessTests
{
///
- /// Test fixture for verifying the class.
+ /// Ensures the basic parsing works from a set of templates and that output files are updated.
///
- public class PreviewProcessTests
+ [Fact]
+ public void EnsurePreviewParsing()
{
- ///
- /// Ensures the basic parsing works from a set of templates and that output files are updated.
- ///
- [Fact]
- public void EnsurePreviewParsing()
- {
- // Arrange
- var instance = new Arrangement().Preview;
+ // Arrange
+ var instance = new Arrangement().Preview;
- // Act
- var result = instance.Render();
- var fileContent = File.ReadAllText(instance.Output);
+ // Act
+ var result = instance.Render();
+ var fileContent = File.ReadAllText(instance.Output);
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- result.Should().Be(fileContent, "The expected result should be written to output file");
- }
+ // Assert
+ result.Should().NotBeEmpty("A result should have been returned");
+ result.Should().Be(fileContent, "The expected result should be written to output file");
+ }
- ///
- /// Ensures XML parsing works.
- ///
- [Fact]
- public void EnsurePreviewXml()
- {
- // Arrange
- var instance = new Arrangement().XmlPreview;
+ ///
+ /// Ensures XML parsing works.
+ ///
+ [Fact]
+ public void EnsurePreviewXml()
+ {
+ // Arrange
+ var instance = new Arrangement().XmlPreview;
- // Act
- var result = instance.Render();
- var fileContent = File.ReadAllText(instance.Output);
+ // Act
+ var result = instance.Render();
+ var fileContent = File.ReadAllText(instance.Output);
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- result.Should().Be(fileContent, "The expected result should be written to output file");
- }
+ // Assert
+ result.Should().NotBeEmpty("A result should have been returned");
+ result.Should().Be(fileContent, "The expected result should be written to output file");
+ }
- ///
- /// Ensures argument parsing works according to the CSharp specification.
- ///
- [Fact]
- public void EnsurePreviewParsingCSharpArguments()
- {
- // Arrange
- var instance = new Arrangement().ArgumentPreview;
+ ///
+ /// Ensures argument parsing works according to the CSharp specification.
+ ///
+ [Fact]
+ public void EnsurePreviewParsingCSharpArguments()
+ {
+ // Arrange
+ var instance = new Arrangement().ArgumentPreview;
+
+ // Act
+ var result = instance.Render();
+ var fileContent = File.ReadAllText(instance.Output);
- // Act
- var result = instance.Render();
- var fileContent = File.ReadAllText(instance.Output);
+ // Assert
+ result.Should().NotBeEmpty("A result should have been returned");
+ result.Should().Be(fileContent, "The expected result should be written to output file");
+ }
- // Assert
- result.Should().NotBeEmpty("A result should have been returned");
- result.Should().Be(fileContent, "The expected result should be written to output file");
+ ///
+ /// Ensure the preview process can be created from a set of arguments.
+ ///
+ /// Determine if a log should be produced.
+ /// First argument.
+ /// Second argument.
+ /// Third argument.
+ /// Fourth argument.
+ /// Fifth argument.
+ /// Sixth argument.
+ /// Seventh argument.
+ /// Eighth argument.
+ [Theory]
+ [InlineData(false, "", "", "", "", "", "", "", "")]
+ [InlineData(false, "--template", "./Resources/event.liquid", "--content", "./Resources/event.json", "--output", "./Resources/preview.txt", "", "")]
+ [InlineData(false, "--template", "./Resources/event.liquid", "", "", "", "", "", "")]
+ [InlineData(false, "--watch", "", "", "", "", "", "", "")]
+ [InlineData(true, "--help", "", "", "", "", "", "", "")]
+ [InlineData(true, "--template", "./Resources/event_not_found.liquid", "--content", "./Resources/event.xml", "--output", "./Resources/preview.txt", "", "")]
+ public void EnsureArgumentParsing(bool shouldLog, string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8)
+ {
+ // Arrange
+ var args = new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 };
+
+ // Act
+ var preview = PreviewProcess.Create(args);
+
+ // Assert
+ preview.Should().NotBeNull("A preview process should have been created");
+
+ if (shouldLog)
+ {
+ preview.Log.Should().NotBeEmpty("A log should have been created");
+ }
+ else
+ {
+ preview.Log.Should().BeEmpty("No log should have been created");
}
+ }
- ///
- /// Ensure the preview process can be created from a set of arguments.
- ///
- /// Determine if a log should be produced.
- /// First argument.
- /// Second argument.
- /// Third argument.
- /// Fourth argument.
- /// Fifth argument.
- /// Sixth argument.
- /// Seventh argument.
- /// Eighth argument.
- [Theory]
- [InlineData(false, "", "", "", "", "", "", "", "")]
- [InlineData(false, "--template", "./Resources/event.liquid", "--content", "./Resources/event.json", "--output", "./Resources/preview.txt", "", "")]
- [InlineData(false, "--template", "./Resources/event.liquid", "", "", "", "", "", "")]
- [InlineData(false, "--watch", "", "", "", "", "", "", "")]
- [InlineData(true, "--help", "", "", "", "", "", "", "")]
- [InlineData(true, "--template", "./Resources/event_not_found.liquid", "--content", "./Resources/event.xml", "--output", "./Resources/preview.txt", "", "")]
- public void EnsureArgumentParsing(bool shouldLog, string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7, string arg8)
+ [Fact]
+ public void EnsureObjectCreation()
+ {
+ // Arrange
+ var instance = new PreviewProcess
{
- // Arrange
- var args = new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 };
+ Template = Arrangement.GetPath("./Resources/albums.liquid"),
+ Content = Arrangement.GetPath("./Resources/albums.xml"),
+ Output = Arrangement.GetPath("./Resources/albums.json")
+ };
+
+ // Act
+ instance.Render();
+
+ // Assert
+ instance.Log.Should().BeEmpty("A log should not have been created");
+ instance.Template.Should().NotBeEmpty("The template should be empty");
+ instance.Content.Should().NotBeEmpty("The content should be empty");
+ instance.Output.Should().NotBeEmpty("The output should be empty");
+ }
- // Act
- var preview = PreviewProcess.Create(args);
+ ///
+ /// Ensure the preview process can use a file watcher.
+ ///
+ [Fact]
+ public void EnsureWatcher()
+ {
+ // Arrange
+ var instance = PreviewProcess.Create(new[] { "--template", "./Resources/event.liquid", "--content", "./Resources/event.json", "--output", "./Resources/preview.txt" });
- // Assert
- preview.Should().NotBeNull("A preview process should have been created");
+ // Act
+ instance.StartWatch();
+ instance.StopWatch();
- if (shouldLog)
- {
- preview.Log.Should().NotBeEmpty("A log should have been created");
- }
- else
- {
- preview.Log.Should().BeEmpty("No log should have been created");
- }
- }
+ // Assert
+ instance.Log.Should().NotBeEmpty("A log should have been created");
+ }
- [Fact]
- public void EnsureObjectCreation()
+ ///
+ /// Contains arranged values used for testing, containing mock instances and expected return values.
+ ///
+ private class Arrangement
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Arrangement()
{
- // Arrange
- var instance = new PreviewProcess
+ Preview = new PreviewProcess
{
- Template = Arrangement.GetPath("./Resources/albums.liquid"),
- Content = Arrangement.GetPath("./Resources/albums.xml"),
- Output = Arrangement.GetPath("./Resources/albums.json")
+ Template = GetPath("./Resources/event.liquid"),
+ Content = GetPath("./Resources/event.json"),
+ Output = GetPath("./Resources/preview.txt")
};
- // Act
- instance.Render();
+ ArgumentPreview = new PreviewProcess
+ {
+ Template = GetPath("./Resources/append.liquid"),
+ Content = GetPath("./Resources/append.100.json"),
+ Output = GetPath("./Resources/append.temp.txt")
+ };
- // Assert
- instance.Log.Should().BeEmpty("A log should not have been created");
- instance.Template.Should().NotBeEmpty("The template should be empty");
- instance.Content.Should().NotBeEmpty("The content should be empty");
- instance.Output.Should().NotBeEmpty("The output should be empty");
+ XmlPreview = new PreviewProcess
+ {
+ Template = GetPath("./Resources/albums.liquid"),
+ Content = GetPath("./Resources/albums.xml"),
+ Output = GetPath("./Resources/albums.json")
+ };
}
///
- /// Ensure the preview process can use a file watcher.
+ /// Gets the preview process object instance.
///
- [Fact]
- public void EnsureWatcher()
- {
- // Arrange
- var instance = PreviewProcess.Create(new[] { "--template", "./Resources/event.liquid", "--content", "./Resources/event.json", "--output", "./Resources/preview.txt" });
+ ///
+ /// The preview process.
+ ///
+ public PreviewProcess ArgumentPreview { get; }
- // Act
- instance.StartWatch();
- instance.StopWatch();
+ ///
+ /// Gets the preview process object instance.
+ ///
+ ///
+ /// The preview process.
+ ///
+ public PreviewProcess Preview { get; }
- // Assert
- instance.Log.Should().NotBeEmpty("A log should have been created");
- }
+ ///
+ /// Gets the preview process object instance.
+ ///
+ ///
+ /// The preview process.
+ ///
+ public PreviewProcess XmlPreview { get; }
///
- /// Contains arranged values used for testing, containing mock instances and expected return values.
+ /// Gets the full path.
///
- private class Arrangement
+ /// The relative path.
+ /// Full path.
+ public static string GetPath(string path)
{
- ///
- /// Initializes a new instance of the class.
- ///
- public Arrangement()
- {
- Preview = new PreviewProcess
- {
- Template = GetPath("./Resources/event.liquid"),
- Content = GetPath("./Resources/event.json"),
- Output = GetPath("./Resources/preview.txt")
- };
-
- ArgumentPreview = new PreviewProcess
- {
- Template = GetPath("./Resources/append.liquid"),
- Content = GetPath("./Resources/append.100.json"),
- Output = GetPath("./Resources/append.temp.txt")
- };
-
- XmlPreview = new PreviewProcess
- {
- Template = GetPath("./Resources/albums.liquid"),
- Content = GetPath("./Resources/albums.xml"),
- Output = GetPath("./Resources/albums.json")
- };
- }
-
- ///
- /// Gets the preview process object instance.
- ///
- ///
- /// The preview process.
- ///
- public PreviewProcess ArgumentPreview { get; }
-
- ///
- /// Gets the preview process object instance.
- ///
- ///
- /// The preview process.
- ///
- public PreviewProcess Preview { get; }
-
- ///
- /// Gets the preview process object instance.
- ///
- ///
- /// The preview process.
- ///
- public PreviewProcess XmlPreview { get; }
-
- ///
- /// Gets the full path.
- ///
- /// The relative path.
- /// Full path.
- public static string GetPath(string path)
- {
- var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
- return Path.GetFullPath(path, basePath);
- }
+ var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
+ return Path.GetFullPath(path, basePath);
}
}
-}
\ No newline at end of file
+}
diff --git a/AzureLiquid.Tests/TemplateFact.cs b/AzureLiquid.Tests/TemplateFact.cs
new file mode 100644
index 0000000..89d1b6e
--- /dev/null
+++ b/AzureLiquid.Tests/TemplateFact.cs
@@ -0,0 +1,32 @@
+namespace AzureLiquid.Tests;
+
+///
+/// A fact check for a rendered template, with data content and expected result.
+///
+/// The underlying type of the data content.
+public class TemplateFact
+{
+ ///
+ /// Gets or sets the template.
+ ///
+ ///
+ /// The template.
+ ///
+ public string? Template { get; set; }
+
+ ///
+ /// Gets or sets the expected result.
+ ///
+ ///
+ /// The expected result.
+ ///
+ public string? Expected { get; set; }
+
+ ///
+ /// Gets or sets the content.
+ ///
+ ///
+ /// The content.
+ ///
+ public T? Content { get; set; }
+}
\ No newline at end of file
diff --git a/AzureLiquid.sln.DotSettings b/AzureLiquid.sln.DotSettings
index 7126d73..5361988 100644
--- a/AzureLiquid.sln.DotSettings
+++ b/AzureLiquid.sln.DotSettings
@@ -1,9 +1,10 @@
True
- <copyright file="$FILENAME$">
+ <copyright file="${File.FileName}">
Licensed under the open source Apache License, Version 2.0.
-Project: $PROJECT$
-Created: $CREATED_YEAR$-$CREATED_MONTH$-$CREATED_DAY$ $CREATED_TIME$
+Project: ${File.ProjectName}
+Created: ${File.CreatedYear}-${File.CreatedMonth}-${File.CreatedDay} ${File.CreatedHour}:${File.CreatedMinute}
</copyright>
+ True
True
\ No newline at end of file