private void textBoxLoanCycle_TextChanged(object sender, EventArgs e) { int?loanCycle = ServicesHelper.ConvertStringToNullableInt32(textBoxLoanCycle.Text); if (!loanCycle.HasValue) { textBoxLoanCycle.BackColor = Color.Red; _tempPerson.LoanCycle = 0; } else { textBoxLoanCycle.BackColor = Color.White; _tempPerson.LoanCycle = loanCycle.Value; } }
public void TestConvertStringToNullableInt32() { Assert.AreEqual(3, ServicesHelper.ConvertStringToNullableInt32("3").Value); }
public void TestConvertStringToNullableInt32WhenStringIsEmpty() { Assert.AreEqual(null, ServicesHelper.ConvertStringToNullableInt32(String.Empty)); }