diff --git a/Blocks.NustacheHelpers.Tests/Blocks.NustacheHelpers.Tests.csproj b/Blocks.NustacheHelpers.Tests/Blocks.NustacheHelpers.Tests.csproj
index e346fd9..f269f93 100644
--- a/Blocks.NustacheHelpers.Tests/Blocks.NustacheHelpers.Tests.csproj
+++ b/Blocks.NustacheHelpers.Tests/Blocks.NustacheHelpers.Tests.csproj
@@ -39,6 +39,9 @@
False
..\packages\NUnit.2.6.2\lib\nunit.framework.dll
+
+ ..\packages\Nustache.1.15.3.5\lib\net20\Nustache.Core.dll
+
@@ -59,10 +62,6 @@
{9655265d-8dda-409f-8f81-9cd91fbee387}
Blocks.NustacheHelpers
-
- {3a725cd9-6024-441f-84b5-4226d78352c5}
- Nustache.Core
-
diff --git a/Blocks.NustacheHelpers.Tests/EqualsHelperTests.cs b/Blocks.NustacheHelpers.Tests/EqualsHelperTests.cs
index f1a9b47..ba5d467 100644
--- a/Blocks.NustacheHelpers.Tests/EqualsHelperTests.cs
+++ b/Blocks.NustacheHelpers.Tests/EqualsHelperTests.cs
@@ -131,6 +131,30 @@ public void IfEqHelper_renders_inverse_with_null_comparand()
result.Should().Be("not equal");
}
+ [Test, Category("if_eq")]
+ public void IfEqHelper_renders_inverse_with_null_target()
+ {
+ object one = null;
+ object two = new { thing = "thing" };
+
+ var result = Render.StringToString("{{#if_eq one compare=two}}equal{{else}}not equal{{/if_eq}}",
+ new { one, two });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("if_eq")]
+ public void IfEqHelper_renders_inverse_with_null_target_and_null_comperand()
+ {
+ object one = null;
+ object two = null;
+
+ var result = Render.StringToString("{{#if_eq one compare=two}}equal{{else}}not equal{{/if_eq}}",
+ new { one, two });
+
+ result.Should().Be("equal");
+ }
+
[Test, Category("unless_eq")]
public void UnlessEqHelper_renders_expected_result_with_equal_objects()
{
@@ -236,6 +260,28 @@ public void UnlessEqHelper_renders_expected_result_with_null_comparand()
result.Should().Be("not equal");
}
+ [Test, Category("unless_eq")]
+ public void UnlessEqHelper_renders_expected_result_with_null_target()
+ {
+ object one = null;
+ object two = new { thing = "thing" };
+
+ var result = Render.StringToString("{{#unless_eq one compare=two}}not equal{{/unless_eq}}", new { one, two });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("unless_eq")]
+ public void UnlessEqHelper_renders_expected_result_with_null_target_and_null_comperand()
+ {
+ object one = null;
+ object two = null;
+
+ var result = Render.StringToString("{{#unless_eq one compare=two}}not equal{{/unless_eq}}", new { one, two });
+
+ result.Should().BeEmpty();
+ }
+
[Test, Category("unless_eq")]
public void UnlessEqHelper_renders_inverse_with_null_comparand()
{
@@ -247,5 +293,105 @@ public void UnlessEqHelper_renders_inverse_with_null_comparand()
result.Should().Be("not equal");
}
+
+ [Test, Category("unless_eq")]
+ public void UnlessEqHelper_renders_inverse_with_null_target()
+ {
+ object one = null;
+ object two = new { thing = "thing" };
+
+ var result = Render.StringToString("{{#unless_eq one compare=two}}not equal{{else}}equal{{/unless_eq}}",
+ new { one, two });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("if_eq_zero")]
+ public void IfEqZeroHelper_renders_expected_with_zero_number()
+ {
+ object one = 0;
+
+ var result = Render.StringToString("{{#if_eq_zero one}}equal{{else}}not equal{{/if_eq_zero}}",
+ new { one });
+
+ result.Should().Be("equal");
+ }
+
+ [Test, Category("if_eq_zero")]
+ public void IfEqZeroHelper_renders_expected_with_zero_string()
+ {
+ object one = "0";
+
+ var result = Render.StringToString("{{#if_eq_zero one}}equal{{else}}not equal{{/if_eq_zero}}",
+ new { one });
+
+ result.Should().Be("equal");
+ }
+
+ [Test, Category("if_eq_zero")]
+ public void IfEqZeroHelper_renders_inverse_with_null()
+ {
+ object one = null;
+
+ var result = Render.StringToString("{{#if_eq_zero one}}equal{{else}}not equal{{/if_eq_zero}}",
+ new { one });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("if_eq_zero")]
+ public void IfEqZeroHelper_renders_inverse_with_not_zero()
+ {
+ object one = 123123;
+
+ var result = Render.StringToString("{{#if_eq_zero one}}equal{{else}}not equal{{/if_eq_zero}}",
+ new { one });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("unless_eq_zero")]
+ public void UnlessEqZeroHelper_renders_expected_with_zero_number()
+ {
+ object one = 0;
+
+ var result = Render.StringToString("{{#unless_eq_zero one}}equal{{else}}not equal{{/unless_eq_zero}}",
+ new { one });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("unless_eq_zero")]
+ public void UnlessEqZeroHelper_renders_expected_with_zero_string()
+ {
+ object one = "0";
+
+ var result = Render.StringToString("{{#unless_eq_zero one}}equal{{else}}not equal{{/unless_eq_zero}}",
+ new { one });
+
+ result.Should().Be("not equal");
+ }
+
+ [Test, Category("unless_eq_zero")]
+ public void UnlessEqZeroHelper_renders_inverse_with_null()
+ {
+ object one = null;
+
+ var result = Render.StringToString("{{#unless_eq_zero one}}equal{{else}}not equal{{/unless_eq_zero}}",
+ new { one });
+
+ result.Should().Be("equal");
+ }
+
+ [Test, Category("unless_eq_zero")]
+ public void UnlessEqZeroHelper_renders_inverse_with_not_zero()
+ {
+ object one = 123123;
+
+ var result = Render.StringToString("{{#unless_eq_zero one}}equal{{else}}not equal{{/unless_eq_zero}}",
+ new { one });
+
+ result.Should().Be("equal");
+ }
}
}
\ No newline at end of file
diff --git a/Blocks.NustacheHelpers.Tests/packages.config b/Blocks.NustacheHelpers.Tests/packages.config
index e6606e6..b096209 100644
--- a/Blocks.NustacheHelpers.Tests/packages.config
+++ b/Blocks.NustacheHelpers.Tests/packages.config
@@ -2,4 +2,5 @@
+
\ No newline at end of file
diff --git a/Blocks.NustacheHelpers.sln b/Blocks.NustacheHelpers.sln
index 706324b..2ba22fa 100644
--- a/Blocks.NustacheHelpers.sln
+++ b/Blocks.NustacheHelpers.sln
@@ -10,8 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7A4A00
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blocks.NustacheHelpers", "Blocks.NustacheHelpers\Blocks.NustacheHelpers.csproj", "{9655265D-8DDA-409F-8F81-9CD91FBEE387}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nustache.Core", "Nustache\Nustache.Core\Nustache.Core.csproj", "{3A725CD9-6024-441F-84B5-4226D78352C5}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blocks.NustacheHelpers.Tests", "Blocks.NustacheHelpers.Tests\Blocks.NustacheHelpers.Tests.csproj", "{653541F0-0960-45EE-B4BA-625D2037A1C8}"
EndProject
Global
@@ -24,10 +22,6 @@ Global
{9655265D-8DDA-409F-8F81-9CD91FBEE387}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9655265D-8DDA-409F-8F81-9CD91FBEE387}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9655265D-8DDA-409F-8F81-9CD91FBEE387}.Release|Any CPU.Build.0 = Release|Any CPU
- {3A725CD9-6024-441F-84B5-4226D78352C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3A725CD9-6024-441F-84B5-4226D78352C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3A725CD9-6024-441F-84B5-4226D78352C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3A725CD9-6024-441F-84B5-4226D78352C5}.Release|Any CPU.Build.0 = Release|Any CPU
{653541F0-0960-45EE-B4BA-625D2037A1C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{653541F0-0960-45EE-B4BA-625D2037A1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{653541F0-0960-45EE-B4BA-625D2037A1C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/Blocks.NustacheHelpers/Blocks.NustacheHelpers.csproj b/Blocks.NustacheHelpers/Blocks.NustacheHelpers.csproj
index 007a6d9..a575559 100644
--- a/Blocks.NustacheHelpers/Blocks.NustacheHelpers.csproj
+++ b/Blocks.NustacheHelpers/Blocks.NustacheHelpers.csproj
@@ -32,6 +32,9 @@
4
+
+ ..\packages\Nustache.1.15.3.5\lib\net20\Nustache.Core.dll
+
@@ -44,10 +47,7 @@
-
- {3a725cd9-6024-441f-84b5-4226d78352c5}
- Nustache.Core
-
+
diff --git a/Blocks.NustacheHelpers/EqualityHelpers.cs b/Blocks.NustacheHelpers/EqualityHelpers.cs
index 86a4d8f..613a104 100644
--- a/Blocks.NustacheHelpers/EqualityHelpers.cs
+++ b/Blocks.NustacheHelpers/EqualityHelpers.cs
@@ -11,9 +11,15 @@ public static void Register()
if (!Helpers.Contains("if_eq"))
Helpers.Register("if_eq", IfEqHelper);
+ if (!Helpers.Contains("if_eq_zero"))
+ Helpers.Register("if_eq_zero", IfEqZeroHelper);
+
if (!Helpers.Contains("unless_eq"))
Helpers.Register("unless_eq", UnlessEqHelper);
+ if (!Helpers.Contains("unless_eq_zero"))
+ Helpers.Register("unless_eq_zero", UnlessEqZeroHelper);
+
if (!Helpers.Contains("if_gt"))
Helpers.Register("if_gt", IfGtHelper);
@@ -45,10 +51,57 @@ public static void Register()
internal static void IfEqHelper(RenderContext ctx, IList