public static Employee CreateNewObjectWithValidNewEmployeeData() { Employee employee = new Employee { EmployeeId = 0, LastName = "Alam", FirstName = "Ashraful", Title = "Mr.", TitleOfCourtesy = "MVP", BirthDate = new DateTime(1983, 1, 23), HireDate = new DateTime(2007, 5, 16), Address = "103 Banani", City = "Dhaka", Region = "N/A", PostalCode = "1207", Country = "Bangladesh", HomePhone = "3901-2420-9334", Extension = "123", Photo = new byte[1] { 0 }, Notes = "Nice person.", ReportsTo = null }; return employee; }
partial void OnEmployeeSaving(Employee employee) { /* an employee's country must be same as his supervisors country */ if (employee.ReportsTo != null) employee.Supervisor = GetEmployeeByEmployeeId((int)employee.ReportsTo); if (employee.Supervisor != null) { if (employee.Country != employee.Supervisor.Country) throw new BusinessRuleViolationOnDbAccessException("An employee's country must be same as his supervisors country."); } }
public void FirstName_ValidValueAssigned_ShouldGetSameValue() { //Arrange Employee employee = new Employee(); const string EXPECTED_FIRST_NAME = "Ashraf"; //Act employee.FirstName = EXPECTED_FIRST_NAME; //Assert string ACTUAL_FIRST_NAME = employee.FirstName; Assert.AreEqual(EXPECTED_FIRST_NAME, ACTUAL_FIRST_NAME, "First name has not been properly set."); }
/// <summary> /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEmployees(Employee employee) { base.AddObject("Employees", employee); }
/// <summary> /// Create a new Employee object. /// </summary> /// <param name="employeeId">Initial value of the EmployeeId property.</param> /// <param name="lastName">Initial value of the LastName property.</param> /// <param name="firstName">Initial value of the FirstName property.</param> /// <param name="hireDate">Initial value of the HireDate property.</param> /// <param name="address">Initial value of the Address property.</param> /// <param name="country">Initial value of the Country property.</param> /// <param name="homePhone">Initial value of the HomePhone property.</param> public static Employee CreateEmployee(global::System.Int32 employeeId, global::System.String lastName, global::System.String firstName, global::System.DateTime hireDate, global::System.String address, global::System.String country, global::System.String homePhone) { Employee employee = new Employee(); employee.EmployeeId = employeeId; employee.LastName = lastName; employee.FirstName = firstName; employee.HireDate = hireDate; employee.Address = address; employee.Country = country; employee.HomePhone = homePhone; return employee; }