Ejemplo n.º 1
0
        public async Task <JQDataTable> GetTable()
        {
            List <PhotoAlbumType> photoAlbums = await GetPhotoAlbum();

            JQDataTable jqueryTable = new JQDataTable();

            foreach (PhotoAlbumType photoAlbum in photoAlbums)
            {
                photoAlbum.ConvertToTable(jqueryTable);
            }
            return(jqueryTable);
        }
        public async Task GetUnitTest()
        {
            JQDataTable fakeResult = new JQDataTable();

            MockPhotoAlbumService.Setup(m => m.GetTable()).Returns(Task.FromResult(fakeResult));
            PhotoAlbumController = new PhotoAlbumController(MockPhotoAlbumService.Object);

            var response = await PhotoAlbumController.Get();

            var okResult = response as OkObjectResult;

            Assert.IsNotNull(okResult.Value);
            MockPhotoAlbumService.Verify(m => m.GetTable(), Times.Once);
        }