Exemplo n.º 1
0
        public async Task ThreeProjectsExist_Executed_ReturnThreeUserSkillAllViewModels()
        {
            // Arrange
            var userSkills = new List <UserSkill>
            {
                new UserSkill(1, 1),
                new UserSkill(2, 2),
                new UserSkill(2, 2)
            };

            var userSkillRepository = new Mock <IUserSkillRepository>();

            userSkillRepository.Setup(pr => pr.GetAllAsync().Result).Returns(userSkills);

            var getAllUserSkillQuery        = new GetAllUserSkillQuery();
            var getAllUserSkillQueryHandler = new GetAllUserSkillQueryHandler(userSkillRepository.Object);

            //Act
            var userSkillViewAllModel = await getAllUserSkillQueryHandler.Handle(getAllUserSkillQuery, new CancellationToken());

            //Assert
            Assert.NotNull(userSkillViewAllModel);

            userSkillRepository.Verify(pr => pr.GetAllAsync().Result, Times.Once);
        }
Exemplo n.º 2
0
        public async Task<IActionResult> GetAll()
        {
            //var userSkills = _userSkillService.GetAll();
            var getAllUserSkillsQuery = new GetAllUserSkillQuery();

            var userSkills = await _mediator.Send(getAllUserSkillsQuery);

            return Ok(userSkills);
        }