예제 #1
0
        public async void GetAlbumsReturn_NotFoundResponse()
        {
            //Mocking Setup
            var mockUserRequest = new Mock <IAlbumRequestHandler>();

            mockUserRequest.Setup(req => req.GetAlbum(1)).ReturnsAsync(GetAlbum());

            var mockIMapper = new Mock <IMapper>();

            mockIMapper.Setup(op => op.Map <AlbumDto>(It.IsAny <Album>())).Returns(GetAlbumDTo());
            //Act
            var controller = new AlbumsController(mockUserRequest.Object, mockIMapper.Object);
            var album      = await controller.GetAlbumByUserId(2);

            //Assert
            Assert.IsType <Microsoft.AspNetCore.Mvc.NotFoundResult>(album.Result);
        }