public void GetSharedInfoDto() { IEnumerable <DepartmentDto> department = new[] { new DepartmentDto { DepartmentDtoId = 1 } }; IEnumerable <CategoryDto> category = new[] { new CategoryDto { CategoryDtoId = 1 } }; IEnumerable <PositionDto> position = new[] { new PositionDto { PositionDtoId = 1 } }; IEnumerable <PositionLevelDto> positionLevel = new[] { new PositionLevelDto { PositionLevelDtoId = 1 } }; IEnumerable <RoleDto> role = new[] { new RoleDto { RoleDtoId = 1 } }; var expectedDepartmentIds = new[] { 1 }; var expectedCategoryIds = new[] { 1 }; var expectedPositionIds = new[] { 1 }; var expectedPositionLevelIds = new[] { 1 }; var expectedRoleIds = new[] { 1 }; A.CallTo(() => _department.GetAll <DepartmentDto>()).Returns(department); A.CallTo(() => _category.GetAll <CategoryDto>()).Returns(category); A.CallTo(() => _position.GetAll <PositionDto>()).Returns(position); A.CallTo(() => _positionLevel.GetAll <PositionLevelDto>()).Returns(positionLevel); A.CallTo(() => _role.GetAll <RoleDto>()).Returns(role); var sharedInfo = _upsertUserService.GetSharedInfoDto(); for (var i = 0; i < expectedDepartmentIds.Length; i++) { Assert.Equal((sharedInfo.DepartmentDtos.ToList())[i].DepartmentDtoId, expectedDepartmentIds[i]); } for (var i = 0; i < expectedCategoryIds.Length; i++) { Assert.Equal((sharedInfo.CategoryDtos.ToList())[i].CategoryDtoId, expectedCategoryIds[i]); } for (var i = 0; i < expectedPositionIds.Length; i++) { Assert.Equal((sharedInfo.PositionDtos.ToList())[i].PositionDtoId, expectedPositionIds[i]); } for (var i = 0; i < expectedPositionLevelIds.Length; i++) { Assert.Equal((sharedInfo.PositionLevelDtos.ToList())[i].PositionLevelDtoId, expectedPositionLevelIds[i]); } for (var i = 0; i < expectedRoleIds.Length; i++) { Assert.Equal((sharedInfo.RoleDtos.ToList())[i].RoleDtoId, expectedRoleIds[i]); } }
public SharedInfoDto GetSharedInfoDto() { var sharedInfo = new SharedInfoDto { DepartmentDtos = _departmentRepository.GetAll <DepartmentDto>(), CategoryDtos = _categoryRepository.GetAll <CategoryDto>(), PositionDtos = _positionRepository.GetAll <PositionDto>(), PositionLevelDtos = _positionLevelRepository.GetAll <PositionLevelDto>(), RoleDtos = _roleRepository.GetAll <RoleDto>() }; return(sharedInfo); }
public void GetAll() { IEnumerable <PositionLevelDto> positionLevels = new PositionLevelDto[] { new PositionLevelDto() { PositionLevelDtoId = 1 }, new PositionLevelDto() { PositionLevelDtoId = 2 } }; var expectedIds = new[] { 1, 2 }; A.CallTo(() => _positionLevel.GetAll <PositionLevelDto>()).Returns(positionLevels); var expectedPositionLevels = _positionLevelService.GetAll().ToList(); Assert.Equal(expectedIds.Length, expectedPositionLevels.Count); for (var i = 0; i < expectedIds.Length; i++) { Assert.Equal(expectedPositionLevels[i].PositionLevelDtoId, expectedIds[i]); } }
public IEnumerable <PositionLevelDto> GetAll() { return(_positionLevelRepository.GetAll <PositionLevelDto>()); }