Skip to content

Instantly share code, notes, and snippets.

@jamiepollock
Created February 1, 2017 04:03
Show Gist options
  • Save jamiepollock/75419a861ab9a907e1977d3a490be3b0 to your computer and use it in GitHub Desktop.
Save jamiepollock/75419a861ab9a907e1977d3a490be3b0 to your computer and use it in GitHub Desktop.
Tests for Decimal conversion in Umbraco Ditto
using NUnit.Framework;
using Our.Umbraco.Ditto.Tests.Mocks;
namespace Our.Umbraco.Ditto.Tests
{
[TestFixture]
[Category("Processors")]
public class DecimalTests
{
public class MyModel
{
public decimal Threshold { get; set; }
}
[TestCase("-0.5")]
[TestCase(-0.5)]
public void DecimalsCanBeNegative(object value)
{
var content = new MockPublishedContent
{
Properties = new []
{
new MockPublishedContentProperty("Threshold", value)
}
};
var model = content.As<MyModel>();
Assert.AreEqual(-0.5, model.Threshold);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment