public async Task ThrowException_IfLastNameLengthIsShort() { var employee = EmployeeGeneratorUtil.GenerateEmployee(); var dto = new EmployeeDto { FirstName = employee.FirstName, LastName = "Ts", CompanyId = employee.CompanyId, OfficeId = employee.OfficeId, ExperienceEmployeeId = employee.ExperienceEmployeeId }; var options = TestUtilities.GetOptions(nameof(ThrowException_IfLastNameLengthIsShort)); using (var actContext = new EmployeeManagementSystemContext(options)) { var sut = new EmployeeService(actContext); await sut.AddAsync(dto); } }
public async Task ThrowException_IfOfficeIsDeleted() { var employee = EmployeeGeneratorUtil.GenerateEmployee(); var office = OfficeGeneratorUtil.GenerateOffice(); office.IsDeleted = true; var dto = new EmployeeDto { FirstName = employee.FirstName, LastName = employee.LastName, CompanyId = 0, OfficeId = office.Id, ExperienceEmployeeId = employee.ExperienceEmployeeId, }; var options = TestUtilities.GetOptions(nameof(ThrowException_IfOfficeIsDeleted)); using (var actContext = new EmployeeManagementSystemContext(options)) { var sut = new EmployeeService(actContext); await sut.AddAsync(dto); } }