Example #1
0
        public async Task GetAllLotteries_Should_Return_Ok_With_IEnumerable_Of_LotteryDetails_ViewModel()
        {
            // Arrange
            _mapper.Map <IEnumerable <LotteryDetailsDto>, IEnumerable <LotteryDetailsViewModel> >(LotteryDetailsDto)
            .Returns(LotteryDetailsViewModel);

            _lotteryService.GetLotteriesAsync(UserAndOrganizationArg).Returns(LotteryDetailsDto);

            // Act
            var response = await _lotteryController.GetAllLotteries();

            // Assert
            Assert.IsNotNull(response);
            Assert.IsInstanceOf <OkNegotiatedContentResult <IEnumerable <LotteryDetailsViewModel> > >(response);
            await _lotteryService.Received(1).GetLotteriesAsync(UserAndOrganizationArg);
        }