Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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;
 }
Esempio n. 4
0
 public ShiftController(
     IShiftService shiftService,
     IEmployeeGroupService employeeGroupService,
     IGroupService groupService)
 {
     this.shiftService         = shiftService;
     this.employeeGroupService = employeeGroupService;
     this.groupService         = groupService;
 }
Esempio n. 5
0
        public async Task GetAllEmployeesFromGroupShouldReturnNothingIfThereAreNoEmployees()
        {
            // Arrange
            this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking());

            // Arrange
            var employees = await this.employeeGroupService.GetAllEmployeesFromGroup <EmployeeGroupIdViewModel>(GroupId);

            // Assert
            Assert.Empty(employees);
        }
Esempio n. 6
0
        public async Task IsEmployeeShouldReturnFalseIfEmplyoeeIsNotInTheGroup()
        {
            // Arrange
            this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking());

            // Act
            var isEmployeeInGroup = await this.employeeGroupService.IsEmployeeInGroup(UserId, GroupId);

            // Assert
            Assert.False(isEmployeeInGroup);
        }
Esempio n. 7
0
        public async Task GetEmployeeIdShouldReturnNullIfSuchDoNotExist()
        {
            // Arrange
            this.employeeGroupService = new EmployeeGroupService(this.GetMockedRepositoryReturningAllAsNoTracking());

            // Act
            var getEmployeeId = await this.employeeGroupService.GetEmployeeId(UserId, GroupId);

            // Assert
            Assert.Null(getEmployeeId);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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");
        }
Esempio n. 10
0
 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;
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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;
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
 public TestChatHub(IEmployeeGroupService employeeGroupService)
 {
     this.employeeGroupService = employeeGroupService;
 }
Esempio n. 16
0
 public PeopleController(IGroupService groupService, IEmployeeGroupService employeeGroupService)
 {
     this.groupService         = groupService;
     this.employeeGroupService = employeeGroupService;
 }
Esempio n. 17
0
 public IsEmployeeInRoleGroupAttribute(string[] roleGroupNames, IEmployeeGroupService employeeGroupService)
 {
     this.employeeGroupService = employeeGroupService;
     this.roleGroupNames       = roleGroupNames;
 }
Esempio n. 18
0
 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;
 }
Esempio n. 20
0
 public EmployeeController(IEmployeeGroupService employeeGroupService, IEmployeeService employeeService)
 {
     this.employeeGroupService = employeeGroupService;
     this.employeeService      = employeeService;
 }