public void NewEmployeeID_WhenCalledInTheDifferentYearButSameMonth_StartsFromZeroAndSerialPartAndGeneratesAndReturnsANewEmployeeID() { int l_yearPart = 01; int l_monthPart = DateTime.Now.Month; List <Employee> employees = new List <Employee>() { new Employee() { DateOfBirth = new DateTime(DateTime.Now.AddYears(-20).Year, 01, 01), DateOfEmployement = new DateTime(2001, l_monthPart, 01), EmployeeID = new EmployeeID(l_yearPart, l_monthPart, 01) }, new Employee() { DateOfBirth = new DateTime(DateTime.Now.AddYears(-20).Year, 01, 01), DateOfEmployement = new DateTime(2001, l_monthPart, 01), EmployeeID = new EmployeeID(l_yearPart, l_monthPart, 02) } }; EmployeeID newEmployeeID = new EmployeeID(int.Parse(DateTime.Now.ToString("yy")), l_monthPart, 01); Expect(() => EmployeeID.NewEmployeeID(employees), Is.EqualTo(newEmployeeID)); }
public void NewEmployeeID_WhenCalledInTheSameYearAndMonth_IcrementsSerialPartAndGeneratesAndReturnsANewEmployeeID() { int l_yearPart = int.Parse(DateTime.Now.ToString("yy")); int l_monthPart = DateTime.Now.Month; List <Employee> employees = new List <Employee>() { new Employee() { DateOfBirth = new DateTime(DateTime.Now.AddYears(-20).Year, 01, 01), DateOfEmployement = new DateTime(DateTime.Now.Year, l_monthPart, 01), EmployeeID = new EmployeeID(l_yearPart, l_monthPart, 01) }, new Employee() { DateOfBirth = new DateTime(DateTime.Now.AddYears(-20).Year, 01, 01), DateOfEmployement = new DateTime(DateTime.Now.Year, l_monthPart, 01), EmployeeID = new EmployeeID(l_yearPart, l_monthPart, 02) } }; EmployeeID newEmployeeID = new EmployeeID(l_yearPart, l_monthPart, 03); Expect(() => EmployeeID.NewEmployeeID(employees), Is.EqualTo(newEmployeeID)); }
/// <summary> /// ایجاد شماره کارمندی جدید /// </summary> /// <returns>شماره کارمندی</returns> public EmployeeID NewEmployeeID() { return(EmployeeID.NewEmployeeID(RetrieveEmployees())); }