예제 #1
0
        public void GetFolderContent_Method_Test_GetContent_Call_Once_Return_Not_Null_Result()
        {
            // Arrange
            var returnModel = new ContentDto();

            _contentService.Setup(f => f.GetContent(null)).Returns(returnModel);

            var controller = new FolderController(_contentService.Object, _mapper);

            // Act
            var result = controller.GetFolderContent();

            // Assert
            Assert.IsNotNull(result);
            _contentService.Verify(f => f.GetContent(null), Times.Once);
        }
예제 #2
0
        public void GetFolderContent_Method_Test_GetContent_Call_Once_With_Not_Null_Parameter_Return_Not_Null_Result()
        {
            // Arrange
            var model = new GetFolderContentViewModel()
            {
                FolderPath = "test"
            };
            var returnModel = new ContentDto();

            _contentService.Setup(f => f.GetContent(model.FolderPath)).Returns(returnModel);

            var controller = new FolderController(_contentService.Object, _mapper);

            // Act
            var result = controller.GetFolderContent();

            // Assert
            Assert.IsNotNull(result);
            _contentService.Verify(f => f.GetContent(model.FolderPath), Times.Once);
        }