Example #1
0
        public async Task GetPartOfAchievement(int pageNumber, int pageSize, string userId)
        {
            //Arrange
            _mockBlankAchievementDocumentService
            .Setup(x => x.GetPartOfAchievement(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()))
            .ReturnsAsync(new List <AchievementDocumentsDTO>());
            //Act
            var result = await _blanksController.GetPartOfAchievement(pageNumber, pageSize, userId);

            //Assert
            _mockBlankAchievementDocumentService.Verify();
            Assert.NotNull(result);
            Assert.IsInstanceOf <ObjectResult>(result);
        }
        public async Task GetPartOfAchievement_ReturnsOkObjectResult(int pageNumber, int pageSize, string userId)
        {
            //Arrange
            _mockBlankAchievementDocumentService
            .Setup(x => x.GetPartOfAchievementAsync(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()))
            .ReturnsAsync(new List <AchievementDocumentsDTO>());

            //Act
            var result = await _blanksController.GetPartOfAchievement(pageNumber, pageSize, userId);

            OkObjectResult okObjectResult = result as OkObjectResult;

            //Assert
            _mockBlankAchievementDocumentService.Verify();
            Assert.NotNull(result);
            Assert.NotNull(okObjectResult.Value);
            Assert.AreEqual("List`1", okObjectResult.Value.GetType().Name);
            Assert.IsInstanceOf <ObjectResult>(result);
        }