Exemple #1
0
        public async Task GetMemberAds_IfCorrect_ShouldReturnList()
        {
            List <MemberAdForListDto> ads = new List <MemberAdForListDto> {
                new MemberAdForListDto {
                    Title       = "Title 1",
                    Description = "Description 1"
                },
                new MemberAdForListDto {
                    Title       = "Title 2",
                    Description = "Description 2"
                }
            };

            _mockMapper.Setup(mp => mp.Map <List <MemberAdForListDto> >(It.IsAny <IEnumerable <Ad> >()))
            .Returns(ads);

            AdManager adManager = new AdManager(_mockAdRepository.Object, _mockMapper.Object, _mockUnitOfWork.Object);

            var result = await adManager.GetAdsAsync();

            Assert.True(result.Data.Count == 2);
            Assert.True(result.Success);
            Assert.True(result.StatusCode == HttpStatusCode.OK);
        }