adding a few more tests.
This commit is contained in:
@@ -2,8 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Umbraco.Core.PropertyEditors.ValueConverters;
|
using Umbraco.Core.PropertyEditors.ValueConverters;
|
||||||
using Umbraco.Core;
|
|
||||||
|
|
||||||
namespace Umbraco.Tests.PropertyEditors
|
namespace Umbraco.Tests.PropertyEditors
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
@@ -96,22 +95,26 @@ namespace Umbraco.Tests.PropertyEditors
|
|||||||
var result = converter.ConvertDataToSource(null, value, false);
|
var result = converter.ConvertDataToSource(null, value, false);
|
||||||
|
|
||||||
Assert.AreEqual(expected, result);
|
Assert.AreEqual(expected, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(null, "1", false, 1)]
|
[TestCase(null, "1", false, 1)]
|
||||||
[TestCase(null, "1", true, 1)]
|
[TestCase(null, "1", true, 1)]
|
||||||
[TestCase(null, "0", false, 0)]
|
[TestCase(null, "0", false, 0)]
|
||||||
[TestCase(null, "0", true, 0)]
|
[TestCase(null, "0", true, 0)]
|
||||||
[TestCase(null, null, false, 0)]
|
[TestCase(null, null, false, 0)]
|
||||||
[TestCase(null, null, true, 0)]
|
[TestCase(null, null, true, 0)]
|
||||||
[TestCase(null, "-1", false, -1)]
|
[TestCase(null, "-1", false, -1)]
|
||||||
[TestCase(null, "-1", true, -1)]
|
[TestCase(null, "-1", true, -1)]
|
||||||
public void CanConvertDecimalAliasPropertyEditor(Core.Models.PublishedContent.PublishedPropertyType propertyType, object value, bool preview, double expected)
|
[TestCase(null, "1.65", false, 1.65)]
|
||||||
{
|
[TestCase(null, "1.65", true, 1.65)]
|
||||||
var converter = new DecimalValueConverter();
|
[TestCase(null, "-1.65", false, -1.65)]
|
||||||
var result = converter.ConvertDataToSource(propertyType, value, preview);
|
[TestCase(null, "-1.65", true, -1.65)]
|
||||||
|
public void CanConvertDecimalAliasPropertyEditor(Core.Models.PublishedContent.PublishedPropertyType propertyType, object value, bool preview, double expected)
|
||||||
Assert.AreEqual(expected, result);
|
{
|
||||||
|
var converter = new DecimalValueConverter();
|
||||||
|
var result = converter.ConvertDataToSource(propertyType, value, preview);
|
||||||
|
|
||||||
|
Assert.AreEqual(expected, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user