public async Task GetAllEmployeesFromGroupShouldReturnAllExistingEmployeesInGroup() { const int numberOfFakeEmployees = 3; // Arrange this.FakeDb.Add(new EmployeeGroup() { UserId = UserId, GroupId = GroupId, Salary = Salary, Position = Position }); this.FakeDb.Add(new EmployeeGroup() { UserId = UserId, GroupId = GroupId, Salary = Salary, Position = Position }); this.FakeDb.Add(new EmployeeGroup() { UserId = UserId, GroupId = GroupId, Salary = Salary, Position = Position }); this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Arrange var employees = await this.employeeGroupService.GetAllEmployeesFromGroup <EmployeeGroupIdViewModel>(GroupId); // Assert Assert.Equal(numberOfFakeEmployees, employees.Count()); }
public async Task IsEmployeeInGroupWithNamesShouldReturnFalseIfEmployeeIsNot() { const string groupName1 = "Test"; const string groupName2 = "Test1"; const string groupName3 = "Test3"; // Arrange var group1 = new Group() { Id = GroupId, BusinessId = BusinessId, Name = groupName3 }; var employeeGroup = new EmployeeGroup { UserId = UserId, GroupId = GroupId, Salary = Salary, Position = Position, Group = group1, }; this.FakeDb.Add(employeeGroup); this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var isInGroupWithNames = await this.employeeGroupService.IsEmployeeInGroupsWithNames(UserId, BusinessId, groupName1, groupName2); // Assert Assert.False(isInGroupWithNames); }
public EmployeeGroupController( IEmployeeGroupService employeeGroupService, UserManager <PlanShiftUser> userManager, IBusinessService businessService) { this.employeeGroupService = employeeGroupService; this.userManager = userManager; this.businessService = businessService; }
public ShiftController( IShiftService shiftService, IEmployeeGroupService employeeGroupService, IGroupService groupService) { this.shiftService = shiftService; this.employeeGroupService = employeeGroupService; this.groupService = groupService; }
public async Task GetAllEmployeesFromGroupShouldReturnNothingIfThereAreNoEmployees() { // Arrange this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Arrange var employees = await this.employeeGroupService.GetAllEmployeesFromGroup <EmployeeGroupIdViewModel>(GroupId); // Assert Assert.Empty(employees); }
public async Task IsEmployeeShouldReturnFalseIfEmplyoeeIsNotInTheGroup() { // Arrange this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var isEmployeeInGroup = await this.employeeGroupService.IsEmployeeInGroup(UserId, GroupId); // Assert Assert.False(isEmployeeInGroup); }
public async Task GetEmployeeIdShouldReturnNullIfSuchDoNotExist() { // Arrange this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var getEmployeeId = await this.employeeGroupService.GetEmployeeId(UserId, GroupId); // Assert Assert.Null(getEmployeeId); }
public async Task AddEmployeeToGroupAddsCorrectly() { // Arrange this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryWithCreateOperations()); // Act var id = await this.employeeGroupService.AddEmployeeToGroupAsync(UserId, GroupId, Salary, Position); // Assert Assert.NotNull(id); Assert.Single(this.FakeDb); }
public AttendanceListViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService, INavigationService navigationService, IEmployeeGroupService employeeGroupService, IDialogService dialogService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(navigationService, nameof(navigationService)); Guard.NotNull(employeeGroupService, nameof(employeeGroupService)); Guard.NotNull(dialogService, nameof(dialogService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; this._navigationService = navigationService; this._employeeGroupService = employeeGroupService; this._dialogService = dialogService; this.DisplayName = CTime2Resources.Get("Navigation.AttendanceList"); this.SelectedUsers = new ReactiveList<AttendingUser>(); this.State = AttendanceListState.Loading; this.LoadUsers = UwCoreCommand.Create(this.LoadUsersImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.AttendanceList")) .HandleExceptions() .TrackEvent("LoadAttendanceList"); this.LoadUsers.ToProperty(this, f => f.Users, out this._usersHelper); var canShowDetails = this.WhenAnyValue(f => f.SelectedUsers).Select(f => f.Any()); this.ShowDetails = UwCoreCommand.Create(canShowDetails, this.ShowDetailsImpl) .HandleExceptions() .TrackEvent("ShowAttendingUserDetails"); var canCreateGroup = this.WhenAnyValue(f => f.State, mode => mode == AttendanceListState.View); this.CreateGroup = UwCoreCommand.Create(canCreateGroup, this.CreateGroupImpl) .HandleExceptions() .TrackEvent("CreateNewEmployeeGroup"); var canSaveGroup = this .WhenAnyValue(f => f.State, f => f.GroupName, (mode, groupName) => mode == AttendanceListState.CreateGroup && string.IsNullOrWhiteSpace(groupName) == false) .CombineLatest(this.SelectedUsers.Changed, (stateAndName, selectedUsers) => stateAndName && this.SelectedUsers.Any()); this.SaveGroup = UwCoreCommand.Create(canSaveGroup, this.SaveGroupImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.SaveEmployeeGroup")) .HandleExceptions() .TrackEvent("SaveNewEmployeeGroup"); var canCancelCreateGroup = this.WhenAnyValue(f => f.State, mode => mode == AttendanceListState.CreateGroup); this.CancelCreateGroup = UwCoreCommand.Create(canCancelCreateGroup, this.CancelCreateGroupImpl) .HandleExceptions() .TrackEvent("CancelCreateNewEmployeeGroup"); var canDeleteGroup = this.WhenAnyValue(f => f.State, mode => mode == AttendanceListState.ViewGroup); this.DeleteGroup = UwCoreCommand.Create(canDeleteGroup, this.DeleteGroupImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.DeleteEmployeeGroup")) .HandleExceptions() .TrackEvent("DeleteEmployeeGroup"); }
public ShiftApplicationController( IShiftApplicationService shiftApplicationService, IShiftService shiftService, IEmployeeGroupService employeeGroupService, IGroupService groupService, UserManager <PlanShiftUser> userManager) { this.shiftApplicationService = shiftApplicationService; this.shiftService = shiftService; this.employeeGroupService = employeeGroupService; this.groupService = groupService; this.userManager = userManager; }
public BusinessController( IBusinessService businessService, IBusinessTypeService businessTypeService, IShiftApplicationService shiftApplicationService, IShiftChangeService shiftChangeService, IEmployeeGroupService employeeGroupService) { this.businessService = businessService; this.businessTypeService = businessTypeService; this.shiftApplicationService = shiftApplicationService; this.shiftChangeService = shiftChangeService; this.employeeGroupService = employeeGroupService; }
public async Task IsEmployeeInGroupShouldReturnTrueIfEmployeeIsInGroup() { // Arrange this.FakeDb.Add(new EmployeeGroup() { UserId = UserId, GroupId = GroupId, Salary = Salary, Position = Position }); this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var isEmployeeInGroup = await this.employeeGroupService.IsEmployeeInGroup(UserId, GroupId); // Assert Assert.True(isEmployeeInGroup); }
public RegisterModel( UserManager <PlanShiftUser> userManager, SignInManager <PlanShiftUser> signInManager, ILogger <RegisterModel> logger, IEmailSender emailSender, IInviteEmployeeVerificationsService inviteEmployeeVerificationsService, IEmployeeGroupService employeeGroupService) { this.Input = new InputModel(); this.userManager = userManager; this.signInManager = signInManager; this.logger = logger; this.emailSender = emailSender; this.inviteEmployeeVerificationsService = inviteEmployeeVerificationsService; this.employeeGroupService = employeeGroupService; }
public async Task GetEmployeeIdShouldReturnEmployeeIdIfExists() { const string employeeId = "Test"; // Arrange this.FakeDb.Add(new EmployeeGroup() { Id = employeeId, UserId = UserId, GroupId = GroupId, Salary = Salary, Position = Position }); this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking()); // Act var getEmployeeId = await this.employeeGroupService.GetEmployeeId(UserId, GroupId); // Assert Assert.Equal(employeeId, getEmployeeId); }
public TestChatHub(IEmployeeGroupService employeeGroupService) { this.employeeGroupService = employeeGroupService; }
public PeopleController(IGroupService groupService, IEmployeeGroupService employeeGroupService) { this.groupService = groupService; this.employeeGroupService = employeeGroupService; }
public IsEmployeeInRoleGroupAttribute(string[] roleGroupNames, IEmployeeGroupService employeeGroupService) { this.employeeGroupService = employeeGroupService; this.roleGroupNames = roleGroupNames; }
public GroupService(IDeletableEntityRepository <Group> groupRepository, IEmployeeGroupService employeeGroupService, IBusinessService businessService) { this.groupRepository = groupRepository; this.employeeGroupService = employeeGroupService; this.businessService = businessService; }
public GroupMembersViewComponent(IEmployeeGroupService employeeGroupService) { this.employeeGroupService = employeeGroupService; }
public EmployeeController(IEmployeeGroupService employeeGroupService, IEmployeeService employeeService) { this.employeeGroupService = employeeGroupService; this.employeeService = employeeService; }