예제 #1
0
        public void Create_InsertsTheTrendGiven()
        {
            //Arrange
            TrendCreateDto trendCreateDto = new TrendCreateDto
            {
                CreatorId = Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6")
            };

            //Act
            TrendGetAllDto trendGetAllDto = systemUnderTest.Create(trendCreateDto);

            //Assert
            Assert.NotNull(trendGetAllDto);
            Assert.True(trendGetAllDto.CreatorId.Equals(trendCreateDto.CreatorId));
        }
예제 #2
0
        ICollection <TrendGetAllDto> ITrendBusinessLogic.GetAll(UserInfoModel userInfo)
        {
            ICollection <Trend>          trends         = trendRepository.GetAll("Follows");
            ICollection <TrendGetAllDto> returnedTrends = new List <TrendGetAllDto>();

            foreach (Trend trend in trends)
            {
                TrendGetAllDto trendGetAllDto = mapper.Map <TrendGetAllDto>(trend);
                if (userInfo != null && trend.Follows != null)
                {
                    TrendFollow follow = trend.Follows.FirstOrDefault(f => f.UserId == userInfo.CreatorId);
                    if (follow != null)
                    {
                        trendGetAllDto.Followed = true;
                    }
                }
                returnedTrends.Add(trendGetAllDto);
            }

            return(returnedTrends);
        }