public string this[string columnName] { get { string result = null; switch (columnName) { case nameof(AdditionalAmount): if (AdditionalAmount < 0) { result = "Колличество не может быть отрицательным"; } else if (!Validation.CountValidationWMB(AdditionalAmount.ToString())) { result = "Количество указано неверно."; } break; } if (ErrorCollection.ContainsKey(columnName)) { ErrorCollection[columnName] = result; } else if (result != null) { ErrorCollection.Add(columnName, result); } OnPropertyChanged("ErrorCollection"); return(result); } }
public void TestToString() { var amount = new AdditionalAmount { AccountType = "10", Amount = "200", AmountType = "01", CurrencyCode = "840", Sign = "C" }; var actual = amount.ToString(); const string Expected = "1001840C000000000200"; Assert.AreEqual(Expected, actual); }