public async Task GetAllPresentationsAsync_Test()
        {
            _mockUnitRepo.Setup(_ => _.Presentations.GetAllAsync())
            .Returns(Task.FromResult(_listPresentationDB as IEnumerable <PresentationDB>));

            var expectedResult = _mapper.Map <IEnumerable <PresentationDB>, IEnumerable <Presentation> >
                                     (_listPresentationDB) as List <Presentation>;

            var result = await _service.GetAllPresentationsAsync() as List <Presentation>;

            expectedResult.Should().BeEquivalentTo(result);
        }
Example #2
0
        public async Task <IHttpActionResult> GetAllPresentationsAsync()
        {
            try
            {
                var result = await _presentationsBase.GetAllPresentationsAsync();

                return(result == null?NotFound() : (IHttpActionResult)Ok(result));
            }
            catch (InvalidOperationException ex)
            {
                return(InternalServerError(ex));
            }
        }