From ee775a2fde44db7bf74345f2a3fbcd588f21e0e2 Mon Sep 17 00:00:00 2001 From: Claus Date: Mon, 26 Jun 2017 11:31:46 +0200 Subject: [PATCH] adding a few more tests. --- .../PropertyEditorValueConverterTests.cs | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueConverterTests.cs b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueConverterTests.cs index 5c67f82c65..73abf62eba 100644 --- a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueConverterTests.cs +++ b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueConverterTests.cs @@ -2,8 +2,7 @@ using System.Collections.Generic; using NUnit.Framework; using Umbraco.Core.PropertyEditors.ValueConverters; -using Umbraco.Core; - + namespace Umbraco.Tests.PropertyEditors { [TestFixture] @@ -96,22 +95,26 @@ namespace Umbraco.Tests.PropertyEditors var result = converter.ConvertDataToSource(null, value, false); Assert.AreEqual(expected, result); - } - - [TestCase(null, "1", false, 1)] - [TestCase(null, "1", true, 1)] - [TestCase(null, "0", false, 0)] - [TestCase(null, "0", true, 0)] - [TestCase(null, null, false, 0)] - [TestCase(null, null, true, 0)] - [TestCase(null, "-1", false, -1)] - [TestCase(null, "-1", true, -1)] - public void CanConvertDecimalAliasPropertyEditor(Core.Models.PublishedContent.PublishedPropertyType propertyType, object value, bool preview, double expected) - { - var converter = new DecimalValueConverter(); - var result = converter.ConvertDataToSource(propertyType, value, preview); - - Assert.AreEqual(expected, result); + } + + [TestCase(null, "1", false, 1)] + [TestCase(null, "1", true, 1)] + [TestCase(null, "0", false, 0)] + [TestCase(null, "0", true, 0)] + [TestCase(null, null, false, 0)] + [TestCase(null, null, true, 0)] + [TestCase(null, "-1", false, -1)] + [TestCase(null, "-1", true, -1)] + [TestCase(null, "1.65", false, 1.65)] + [TestCase(null, "1.65", true, 1.65)] + [TestCase(null, "-1.65", false, -1.65)] + [TestCase(null, "-1.65", true, -1.65)] + public void CanConvertDecimalAliasPropertyEditor(Core.Models.PublishedContent.PublishedPropertyType propertyType, object value, bool preview, double expected) + { + var converter = new DecimalValueConverter(); + var result = converter.ConvertDataToSource(propertyType, value, preview); + + Assert.AreEqual(expected, result); } } }