public void IsValid_WithValidInput_Passes(string validEmployeeIdString, int year, int month, int day) { EmployeeID employeeId = EmployeeID.Parse(validEmployeeIdString); DateTime dateTime = new DateTime(year, month, day); Expect(EmployeeID.IsValid(employeeId, dateTime), Is.True); }
public void Parse_ProvidedWithValidInput_ReturnsEqualEmployeeId(string validInput, int yearPart, int monthPart, int serialPart) { EmployeeID employeeId = new EmployeeID(yearPart, monthPart, serialPart); Expect(() => EmployeeID.Parse(validInput) , Is.EqualTo(employeeId)); }
public void IsValid_WithInValidInput_Fails(string validEmployeeIdString, int year, int month, int day) { //TODO: needs more work EmployeeID employeeId = EmployeeID.Parse(validEmployeeIdString); DateTime dateTime = new DateTime(year, month, day); Expect(EmployeeID.IsValid(employeeId, dateTime), Is.False); }
/// <summary> /// تبدیل رشته به EmployeeID متناظر /// </summary> /// <param name="value">یک string</param> /// <param name="targetType">یک EmployeeID</param> /// <param name="parameter">این پارامتر در EmployeeIDToStringConverter استفاده نمی شود</param> /// <param name="culture">این پارامتر در EmployeeIDToStringConverter استفاده نمی شود</param> /// <returns>نمونه متناظر EmployeeID</returns> public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (targetType == typeof(EmployeeID) && value != null) { return(EmployeeID.Parse((string)value)); } else { return(null); } }
public void Parse_ProvidedWithInvalidInput_ThrowsInvalidEmployeeIDFormatException(string invalidInput) { Expect(() => EmployeeID.Parse(invalidInput), Throws.Exception.TypeOf <InvalidEmployeeIDFormatException>()); }