示例#1
0
        public async Task <IActionResult> Get()
        {
            var goals = await GoalService.GetAllAsync();

            var goalsModels = GoalMapper.Map(goals);

            return(Ok(goalsModels));
        }
示例#2
0
        public async Task GetAllAsync_ShouldCallMethodCorrectly(
            List <Goal> goals,
            GoalService sut)
        {
            // Arrange
            sut.GoalQuery.GetAllAsync().Returns(goals);

            // Act
            var result = await sut.GetAllAsync();

            // Asserts
            result.Should().NotBeNull();
            result.Should().BeEquivalentTo(goals);
            result.Should().BeOfType <List <Goal> >();
            await sut.GoalQuery.Received(1).GetAllAsync();
        }