public void Should_Map_ShiftDto_to_Shift() { // Arrange var _mShift = new Mock <Shift>(); var shiftDto = new ShiftDto { IsActive = true, IsAssigned = true, ShiftTemplateId = 1, CalendarResourceRequirementId = 1, StartDate = new DateTime(), EndDate = new DateTime(), EmployeeId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(shiftDto, _mShift.Object); // Assert Assert.AreEqual(shiftDto.IsActive, _mShift.Object.IsActive); Assert.AreEqual(shiftDto.IsAssigned, _mShift.Object.IsAssigned); Assert.AreEqual(shiftDto.ShiftTemplateId, _mShift.Object.ShiftTemplateId); Assert.AreEqual(shiftDto.StartDate, _mShift.Object.StartDate); Assert.AreEqual(shiftDto.EndDate, _mShift.Object.EndDate); Assert.AreEqual(shiftDto.EmployeeId, _mShift.Object.EmployeeId); }
public void Should_Map_CalendarDto_to_Calendar() { // Arrange var _mCalendar = new Mock <Calendar>(); var calendarDto = new CalendarDto { IsActive = true, StartDate = _testDateTime, EndDate = _testDateTime, Name = _testNameString, SiteId = 1, SubSiteId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(calendarDto, _mCalendar.Object); // Assert Assert.AreEqual(calendarDto.IsActive, _mCalendar.Object.IsActive); Assert.AreEqual(calendarDto.StartDate, _mCalendar.Object.StartDate); Assert.AreEqual(calendarDto.EndDate, _mCalendar.Object.EndDate); Assert.AreEqual(calendarDto.Name, _mCalendar.Object.Name); Assert.AreEqual(calendarDto.SiteId, _mCalendar.Object.SiteId); Assert.AreEqual(calendarDto.SubSiteId, _mCalendar.Object.SubSiteId); }
public void Should_Map_ShiftProfileDto_to_ShiftProfile() { // Arrange var _mShiftProfile = new Mock <ShiftProfile>(); var shiftProfileDto = new ShiftProfileDto { IsActive = true, StartDateTime = _testDateTime, EndDateTime = _testDateTime, EmployeeId = 1, //HoursWorked = 12, ShiftId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(shiftProfileDto, _mShiftProfile.Object); // Assert Assert.AreEqual(shiftProfileDto.IsActive, _mShiftProfile.Object.IsActive); Assert.AreEqual(shiftProfileDto.StartDateTime, _mShiftProfile.Object.StartDateTime); Assert.AreEqual(shiftProfileDto.EndDateTime, _mShiftProfile.Object.EndDateTime); Assert.AreEqual(shiftProfileDto.HoursWorked, _mShiftProfile.Object.HoursWorked); Assert.AreEqual(shiftProfileDto.EmployeeId, _mShiftProfile.Object.EmployeeId); Assert.AreEqual(shiftProfileDto.ShiftId, _mShiftProfile.Object.ShiftId); }
public void Should_Map_LeaveReuquestDto_to_LeaveRequest() { // Arrange var _mLeaveRequest = new Mock <LeaveRequest>(); var leaveRequestDto = new LeaveRequestDto { IsActive = true, EmployeeId = null, AmountRequested = 100, StartDateTime = _testDateTime, EndDateTime = _testDateTime, IsApproved = true, IsTaken = true, LeaveTypeId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(leaveRequestDto, _mLeaveRequest.Object); // Assert Assert.AreEqual(leaveRequestDto.IsActive, _mLeaveRequest.Object.IsActive); Assert.AreEqual(leaveRequestDto.EmployeeId, _mLeaveRequest.Object.EmployeeId); Assert.AreEqual(leaveRequestDto.AmountRequested, _mLeaveRequest.Object.AmountRequested); Assert.AreEqual(leaveRequestDto.StartDateTime, _mLeaveRequest.Object.StartDateTime); Assert.AreEqual(leaveRequestDto.EndDateTime, _mLeaveRequest.Object.EndDateTime); Assert.AreEqual(leaveRequestDto.IsApproved, _mLeaveRequest.Object.IsApproved); Assert.AreEqual(leaveRequestDto.IsTaken, _mLeaveRequest.Object.IsTaken); Assert.AreEqual(leaveRequestDto.LeaveTypeId, _mLeaveRequest.Object.LeaveTypeId); }
public void Should_map_PersonnelLeaveProfileDto_to_PersonnelLeaveProfile() { // Arrange var _mProfile = new Mock <PersonnelLeaveProfile>(); var profileDto = new PersonnelLeaveProfileDto { IsActive = true, EmployeeId = 1, LeaveTypeId = 1, Notes = _testNameString, NumberOfDaysAllocated = 20, NumberOfDaysRemaining = 10, NumberOfDaysTaken = 10 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(profileDto, _mProfile.Object); // Assert Assert.AreEqual(profileDto.IsActive, _mProfile.Object.IsActive); Assert.AreEqual(profileDto.EmployeeId, _mProfile.Object.EmployeeId); Assert.AreEqual(profileDto.LeaveTypeId, _mProfile.Object.LeaveTypeId); Assert.AreEqual(profileDto.Notes, _mProfile.Object.Notes); Assert.AreEqual(profileDto.NumberOfDaysAllocated, _mProfile.Object.NumberOfDaysAllocated); Assert.AreEqual(profileDto.NumberOfDaysTaken, _mProfile.Object.NumberOfDaysTaken); Assert.AreEqual(profileDto.NumberOfDaysRemaining, _mProfile.Object.NumberOfDaysRemaining); }
public void Should_Map_EmployeeDto_to_Employee() { // Arrange var _mEmployee = new Mock <Employee>(); var employeeDto = new EmployeeDto { IsActive = true, Address = _testAddressString, City = _testCityString, Postcode = _testPostcodeString, CompanyId = 1, EmployeeTypeId = 1, GenderId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(employeeDto, _mEmployee.Object); // Assert Assert.AreEqual(employeeDto.IsActive, _mEmployee.Object.IsActive); Assert.AreEqual(employeeDto.Address, _mEmployee.Object.Address); Assert.AreEqual(employeeDto.City, _mEmployee.Object.City); Assert.AreEqual(employeeDto.Postcode, _mEmployee.Object.Postcode); Assert.AreEqual(employeeDto.CompanyId, _mEmployee.Object.CompanyId); Assert.AreEqual(employeeDto.EmployeeTypeId, _mEmployee.Object.EmployeeTypeId); Assert.AreEqual(employeeDto.GenderId, _mEmployee.Object.GenderId); }
public void Should_Map_BudgetPeriodDto_to_BudgetPeriod() { // Arrange var _mBudgetPeriod = new Mock <BudgetPeriod>(); var budgetPeriodDto = new BudgetPeriodDto { IsActive = true, StartDate = _testDateTime, EndDate = _testDateTime, ActualSpendTotal = 1000, Amount = 1001, ForecastTotal = 1200 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(budgetPeriodDto, _mBudgetPeriod.Object); // Assert Assert.AreEqual(budgetPeriodDto.IsActive, _mBudgetPeriod.Object.IsActive); Assert.AreEqual(budgetPeriodDto.StartDate, _mBudgetPeriod.Object.StartDate); Assert.AreEqual(budgetPeriodDto.EndDate, _mBudgetPeriod.Object.EndDate); Assert.AreEqual(budgetPeriodDto.ActualSpendTotal, _mBudgetPeriod.Object.ActualSpendTotal); Assert.AreEqual(budgetPeriodDto.Amount, _mBudgetPeriod.Object.Amount); Assert.AreEqual(budgetPeriodDto.ForecastTotal, _mBudgetPeriod.Object.ForecastTotal); }
public void Should_Map_ContractDto_to_Contract() { // Arrange var _mContract = new Mock <Contract>(); var contractDto = new ContractDto { IsActive = true, EmployeeId = null, BaseRateOverride = 1.25, OvertimeModifierOverride = 2, ResourceId = 1, WeeklyHours = 40.5 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(contractDto, _mContract.Object); // Assert Assert.AreEqual(contractDto.IsActive, _mContract.Object.IsActive); Assert.AreEqual(contractDto.EmployeeId, _mContract.Object.EmployeeId); Assert.AreEqual(contractDto.BaseRateOverride, _mContract.Object.BaseRateOverride); Assert.AreEqual(contractDto.OvertimeModifierOverride, _mContract.Object.OvertimeModifierOverride); Assert.AreEqual(contractDto.ResourceId, _mContract.Object.ResourceId); Assert.AreEqual(contractDto.WeeklyHours, _mContract.Object.WeeklyHours); }
public void Should_Map_CompanyDto_to_Company() { // Arrange var _mCompany = new Mock <Company>(); var companyDto = new CompanyDto { IsActive = true, Address = _testAddressString, City = _testCityString, Postcode = _testPostcodeString, Telephone = _testTelephoneString, Fax = _testFaxString, ContactName = _testNameString, Email = _testEmailString }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(companyDto, _mCompany.Object); // Assert Assert.AreEqual(companyDto.IsActive, _mCompany.Object.IsActive); Assert.AreEqual(companyDto.Address, _mCompany.Object.Address); Assert.AreEqual(companyDto.City, _mCompany.Object.City); Assert.AreEqual(companyDto.Postcode, _mCompany.Object.Postcode); Assert.AreEqual(companyDto.Telephone, _mCompany.Object.Telephone); Assert.AreEqual(companyDto.Fax, _mCompany.Object.Fax); Assert.AreEqual(companyDto.ContactName, _mCompany.Object.ContactName); Assert.AreEqual(companyDto.Email, _mCompany.Object.Email); }
public void Update(CalendarResourceRequirementDto calendarResourceRequirementDto, long userId) { var calResRq = _unitOfWork.CalendarResourceRequirementRepository.GetById(calendarResourceRequirementDto.Id); if (calResRq.StartDate < calendarResourceRequirementDto.StartDate) { calendarResourceRequirementDto.StartDate = calResRq.StartDate; } if (calResRq.EndDate > calendarResourceRequirementDto.EndDate) { // keep existing start date for existing cal res req lines. calendarResourceRequirementDto.EndDate = calResRq.EndDate; } CommonHelperAppService.MapDtoToEntityForUpdating(calendarResourceRequirementDto, calResRq); _unitOfWork.CalendarResourceRequirementRepository.Update(calResRq); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.CalendarResourceRequirementTableName, userId, calResRq.Id); }
public void Should_Map_BudgetDto_to_Budget() { // Arrange var _mBudget = new Mock <Budget>(); var budgetDto = new BudgetDto { IsActive = true, ActualTotal = 100, ForecastTotal = 120, StartDate = _testDateTime, EndDate = _testDateTime, SiteId = 1, SubSiteId = null }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(budgetDto, _mBudget.Object); // Assert Assert.AreEqual(budgetDto.IsActive, _mBudget.Object.IsActive); Assert.AreEqual(budgetDto.ActualTotal, _mBudget.Object.ActualTotal); Assert.AreEqual(budgetDto.ForecastTotal, _mBudget.Object.ForecastTotal); Assert.AreEqual(budgetDto.StartDate, _mBudget.Object.StartDate); Assert.AreEqual(budgetDto.EndDate, _mBudget.Object.EndDate); Assert.AreEqual(budgetDto.SiteId, _mBudget.Object.SiteId); Assert.AreEqual(budgetDto.SubSiteId, _mBudget.Object.SubSiteId); }
public void Should_Map_UserDto_to_User() { // Arrange var _mUser = new Mock <User>(); var userDto = new UserDto { IsActive = true, Email = _testEmailString, Firstname = _testNameString, Lastname = _testNameString, Password = _testNameString, IsAccountLocked = false, Login = _testNameString, SystemAccessRoleId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(userDto, _mUser.Object); // Assert Assert.AreEqual(userDto.IsActive, _mUser.Object.IsActive); Assert.AreEqual(userDto.Email, _mUser.Object.Email); Assert.AreEqual(userDto.Firstname, _mUser.Object.Firstname); Assert.AreEqual(userDto.Lastname, _mUser.Object.Lastname); Assert.AreEqual(userDto.Password, _mUser.Object.Password); Assert.AreEqual(userDto.IsAccountLocked, _mUser.Object.IsAccountLocked); Assert.AreEqual(userDto.Login, _mUser.Object.Login); Assert.AreEqual(userDto.SystemAccessRoleId, _mUser.Object.SystemAccessRoleId); }
public void Should_Map_ShiftTemplateDto_to_ShiftTemplate() { // Arrange var _mshiftTemplate = new Mock <ShiftTemplate>(); var shiftTemplateDto = new ShiftTemplateDto { IsActive = true, Duration = 8.5, EndTime = DateTime.UtcNow, StartTime = DateTime.UtcNow, Name = "RMN Day", ShiftRate = 9.5m, ResourceId = 1, SiteId = 13, SubSiteId = null, UnpaidBreakDuration = 0.5, Mon = true, Tue = true, Wed = true, Thu = true, Fri = true, Sat = false, Sun = false }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(shiftTemplateDto, _mshiftTemplate.Object); // Assert Assert.AreEqual(shiftTemplateDto.IsActive, _mshiftTemplate.Object.IsActive); Assert.AreEqual(shiftTemplateDto.Name, _mshiftTemplate.Object.Name); Assert.AreEqual(shiftTemplateDto.ShiftTypeId, _mshiftTemplate.Object.ShiftTypeId); Assert.AreEqual(shiftTemplateDto.ResourceId, _mshiftTemplate.Object.ResourceId); Assert.AreEqual(shiftTemplateDto.SiteId, _mshiftTemplate.Object.SiteId); Assert.AreEqual(shiftTemplateDto.SubSiteId, _mshiftTemplate.Object.SubSiteId); Assert.AreEqual(shiftTemplateDto.StartTime, _mshiftTemplate.Object.StartTime); Assert.AreEqual(shiftTemplateDto.EndTime, _mshiftTemplate.Object.EndTime); Assert.AreEqual(shiftTemplateDto.Duration, _mshiftTemplate.Object.Duration); Assert.AreEqual(shiftTemplateDto.UnpaidBreakDuration, _mshiftTemplate.Object.UnpaidBreakDuration); Assert.AreEqual(shiftTemplateDto.ShiftRate, _mshiftTemplate.Object.ShiftRate); Assert.AreEqual(shiftTemplateDto.Mon, _mshiftTemplate.Object.Mon); Assert.AreEqual(shiftTemplateDto.Tue, _mshiftTemplate.Object.Tue); Assert.AreEqual(shiftTemplateDto.Wed, _mshiftTemplate.Object.Wed); Assert.AreEqual(shiftTemplateDto.Thu, _mshiftTemplate.Object.Thu); Assert.AreEqual(shiftTemplateDto.Fri, _mshiftTemplate.Object.Fri); Assert.AreEqual(shiftTemplateDto.Sat, _mshiftTemplate.Object.Sat); Assert.AreEqual(shiftTemplateDto.Sun, _mshiftTemplate.Object.Sun); }
public void Update(SitePersonnelLookupDto sitePersonnelLookupDto, long userId) { var sitePersonnelLookup = _unitOfWork.SitePersonnelLookupRepository.GetById(sitePersonnelLookupDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(sitePersonnelLookupDto, sitePersonnelLookup); _unitOfWork.SitePersonnelLookupRepository.Update(sitePersonnelLookup); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.SitePersonnelLookupTableName, userId, sitePersonnelLookup.Id); }
public void Update(UserDefinedSystemConfigDto udscDto, long userId) { var systemConfig = _unitOfWork.UserDefinedSystemConfigRepository.GetById(udscDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(udscDto, systemConfig); _unitOfWork.UserDefinedSystemConfigRepository.Update(systemConfig); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.UserDefinedSystemConfigTableName, userId, systemConfig.Id); }
public void Update(SubSiteDto subSiteDto, long userId) { var subSite = _unitOfWork.SubSiteRepository.GetById(subSiteDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(subSiteDto, subSite); _unitOfWork.SubSiteRepository.Update(subSite); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.SubSiteTableName, userId, subSite.Id); }
public void Update(EmployeeDto employeeDto, long userId) { var employee = _unitOfWork.EmployeeRepository.GetById(employeeDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(employeeDto, employee); _unitOfWork.EmployeeRepository.Update(employee); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.EmployeeTableName, userId, employee.Id); }
public void Update(BudgetPeriodDto budgetPeriodDto, long userId) { var budgetPeriod = _unitOfWork.BudgetPeriodRepository.GetById(budgetPeriodDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(budgetPeriodDto, budgetPeriod); _unitOfWork.BudgetPeriodRepository.Update(budgetPeriod); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.BudgetPeriodTableName, userId, budgetPeriod.Id); }
public void Update(LeaveTypeDto leaveTypeDto, long userId) { var leaveType = _unitOfWork.LeaveTypeRepository.GetById(leaveTypeDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(leaveTypeDto, leaveType); _unitOfWork.LeaveTypeRepository.Update(leaveType); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.LeaveTypeTableName, userId, leaveType.Id); }
// CRUD public void Update(UserDto userDto, long userId) { var user = _unitOfWork.UserRepository.GetById(userDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(userDto, user); _unitOfWork.UserRepository.Update(user); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.UserTableName, userId, user.Id); }
public void Update(CompanyDto companyDto, long userId) { var company = _unitOfWork.CompanyRepository.GetById(companyDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(companyDto, company); _unitOfWork.CompanyRepository.Update(company); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.CompanyTableName, userId, company.Id); }
public void Update(TimeAdjustmentFormDto timeAdjustmentFormDto, long userId) { var timeAdjustmentForm = _unitOfWork.TimeAdjustmentFormRepository.GetById(timeAdjustmentFormDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(timeAdjustmentFormDto, timeAdjustmentForm); _unitOfWork.TimeAdjustmentFormRepository.Update(timeAdjustmentForm); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.TimeAdjustmentFormTableName, userId, timeAdjustmentForm.Id); }
public void Update(ResourceDto resourceDto, long userId) { var resource = _unitOfWork.ResourceRepository.GetById(resourceDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(resourceDto, resource); _unitOfWork.ResourceRepository.Update(resource); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.ResourceTableName, userId, resource.Id); }
public void Update(CalendarDto calendarDto, long userId) { var calendar = _unitOfWork.CalendarRepository.GetById(calendarDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(calendarDto, calendar); _unitOfWork.CalendarRepository.Update(calendar); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.CalendarTableName, userId, calendar.Id); }
public void Update(PersonnelLeaveProfileDto personnelLeaveProfileDto, long userId) { var leaveProfile = _unitOfWork.PersonnelLeaveProfileRepository.GetById(personnelLeaveProfileDto.Id); CommonHelperAppService.MapDtoToEntityForUpdating(personnelLeaveProfileDto, leaveProfile); _unitOfWork.PersonnelLeaveProfileRepository.Update(leaveProfile); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.PersonnelLeaveProfileTableName, userId, leaveProfile.Id); }
public void UpdateUserPassword(UserDto userDto, long userId) { userDto.Password = HashPassword(userDto.Password); var user = Mapper.Map <User>(userDto); CommonHelperAppService.MapDtoToEntityForUpdating(userDto, user); _unitOfWork.UserRepository.Update(user); _unitOfWork.Save(); // Audit _auditLogAppService.Audit( AppConstants.ActionTypeUpdate, AppConstants.UserTableName, userId, user.Id); }
public void Should_map_CalendarResourceRequirementDto_to_CalendarResourceRequirement() { // Arrange var _mCalResRq = new Mock <CalendarResourceRequirement>(); var calResRqDto = new CalendarResourceRequirementDto { IsActive = true, CalendarId = 1 }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(calResRqDto, _mCalResRq.Object); // Assert Assert.AreEqual(calResRqDto.IsActive, _mCalResRq.Object.IsActive); Assert.AreEqual(calResRqDto.CalendarId, _mCalResRq.Object.CalendarId); }
public void Should_Map_GenderDto_to_Gender() { // Arrange var _mGender = new Mock <Gender>(); var genderDto = new GenderDto { IsActive = true, Name = _testNameString }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(genderDto, _mGender.Object); // Assert Assert.AreEqual(genderDto.IsActive, _mGender.Object.IsActive); Assert.AreEqual(genderDto.Name, _mGender.Object.Name); }
public void Should_Map_SubSiteTypeDto_to_SubSiteType() { // Arrange var _mSubSiteType = new Mock <SubSiteType>(); var subSiteTypeDto = new SubSiteTypeDto { IsActive = true, Name = _testNameString }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(subSiteTypeDto, _mSubSiteType.Object); // Assert Assert.AreEqual(subSiteTypeDto.IsActive, _mSubSiteType.Object.IsActive); Assert.AreEqual(subSiteTypeDto.Name, _mSubSiteType.Object.Name); }
public void Should_Map_SystemAccessRoleDto_to_SystemAccessRole() { // Arrange var _mRole = new Mock <SystemAccessRole>(); var roleDto = new SystemAccessRoleDto { IsActive = true, Name = _testNameString }; // Act CommonHelperAppService.MapDtoToEntityForUpdating(roleDto, _mRole.Object); // Assert Assert.AreEqual(roleDto.IsActive, _mRole.Object.IsActive); Assert.AreEqual(roleDto.Name, _mRole.Object.Name); }