public void TestGetValue_MinEqualsMax() { // Arrange const decimal minMax = 10; var columnInfo = new MoneyColumnInfo { IsNullable = false, Min = minMax, Max = minMax }; var strategy = new MoneyColumnValueStrategy(RepoFactory); // Act string value = strategy.GetValue(columnInfo); // Assert decimal intValue = decimal.Parse(value, CultureInfo.InvariantCulture); Assert.AreEqual(minMax, intValue); }
public void TestGetValue_Precision() { // Arrange var columnInfo = new MoneyColumnInfo { IsNullable = false, Min = 1, Max = 9, Precision = 3 }; var strategy = new MoneyColumnValueStrategy(RepoFactory); // Act string value = strategy.GetValue(columnInfo); // Assert Regex regex = new Regex(@"^\d\.\d\d\d$"); Assert.IsTrue(regex.IsMatch(value)); }
public void TestGetValue_MinMax() { // Arrange const decimal min = -10.5M; const decimal max = 10.5M; var columnInfo = new MoneyColumnInfo { IsNullable = false, Min = min, Max = max }; var strategy = new MoneyColumnValueStrategy(RepoFactory); // Act string value = strategy.GetValue(columnInfo, CultureInfo.InvariantCulture); // Assert decimal decimalValue = decimal.Parse(value, CultureInfo.InvariantCulture); Assert.IsTrue(min <= decimalValue && decimalValue <= max); }