diff --git a/Nop.Plugin.Api.Tests/Nop.Plugin.Api.Tests.csproj b/Nop.Plugin.Api.Tests/Nop.Plugin.Api.Tests.csproj
index a482327..0222d5e 100644
--- a/Nop.Plugin.Api.Tests/Nop.Plugin.Api.Tests.csproj
+++ b/Nop.Plugin.Api.Tests/Nop.Plugin.Api.Tests.csproj
@@ -188,6 +188,7 @@
+
diff --git a/Nop.Plugin.Api.Tests/ValidatorTests/TypeValidatorTests_IsValid.cs b/Nop.Plugin.Api.Tests/ValidatorTests/TypeValidatorTests_IsValid.cs
new file mode 100644
index 0000000..bf5b556
--- /dev/null
+++ b/Nop.Plugin.Api.Tests/ValidatorTests/TypeValidatorTests_IsValid.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using Nop.Plugin.Api.DTOs.Products;
+using NUnit.Framework;
+using Nop.Plugin.Api.Tests.SerializersTests.DummyObjects;
+using Nop.Plugin.Api.Validators;
+
+namespace Nop.Plugin.Api.Tests.ValidatorTests
+{
+ public class TypeValidatorTests_IsValid
+ {
+ [Test]
+ [SetCulture("de-de")]
+ [Description("Regression test for issue #11 - https://github.com/SevenSpikes/api-plugin-for-nopcommerce/issues/11")]
+ public void WhenCurrentCultureUsesCommaAsDecimalPoint_ShouldProperlyValidateProductPrice()
+ {
+ //Arange
+ Dictionary properties = new Dictionary();
+ properties.Add("price", 33.33);
+
+ var cut = new TypeValidator();
+
+ //Act
+ bool result = cut.IsValid(properties);
+
+ // Assert
+ Assert.IsTrue(result);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Nop.Plugin.Api/Validators/TypeValidator.cs b/Nop.Plugin.Api/Validators/TypeValidator.cs
index a88927e..ed0126c 100644
--- a/Nop.Plugin.Api/Validators/TypeValidator.cs
+++ b/Nop.Plugin.Api/Validators/TypeValidator.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Globalization;
using System.Reflection;
using AutoMapper.Configuration;
using Newtonsoft.Json;
@@ -109,7 +110,7 @@ private bool IsCurrentPropertyValid(Type type, object value)
// This is needed because the isValid method does not work well if the value it is trying to validate is object.
if (value != null)
{
- valueToValidate = value.ToString();
+ valueToValidate = string.Format(CultureInfo.InvariantCulture, "{0}", value);
}
if (!converter.IsValid(valueToValidate)) isCurrentPropertyValid = false;