Exemple #1
0
        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);
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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);
     }
 }
Exemple #5
0
 public void Parse_ProvidedWithInvalidInput_ThrowsInvalidEmployeeIDFormatException(string invalidInput)
 {
     Expect(() => EmployeeID.Parse(invalidInput), Throws.Exception.TypeOf <InvalidEmployeeIDFormatException>());
 }