Пример #1
0
        public void OnGetSingleDataCardTest()
        {
            const string adventureid = "adventureId";
            var adventureReview = new AdventureReview { Id = adventureid };
            var getSingleDataCardRequest = new AdventureDataCard { Id = "dataCardId" };
            var singleDataCard = new AdventureDataCard { Id = "dataCardId", AdventureReview = adventureReview };
            var singleDataCardList = new List<AdventureDataCard> { getSingleDataCardRequest };

            var expectedSingleDataCardResponse = new AdventureDataCardGetResponse(getSingleDataCardRequest)
                                                     {DataCards = singleDataCardList};

            var mock = new Mock<IAdventureDataCardRepository>();
            mock.Setup(a => a.GetAdventureDataCardById(getSingleDataCardRequest.Id)).Returns(singleDataCard);

            var target = new AdventureDataCardService { AdventureDataCardRepository = mock.Object };

            var actual = target.OnGet(getSingleDataCardRequest) as AdventureDataCardGetResponse;
            Assert.AreEqual(expectedSingleDataCardResponse, actual);
        }
Пример #2
0
        public void OnGetReviewDataCardsTest()
        {
            const string adventureid = "adventureId";
            var adventureReview = new AdventureReview { Id = adventureid };
            var getReviewDataCardsRequest = new AdventureDataCard { AdventureReview = adventureReview };

            var reviewDataCardList = new List<AdventureDataCard>
                                         {
                                             new AdventureDataCard {Id = "dataCardOne", AdventureReview = adventureReview},
                                             new AdventureDataCard {Id = "dataCardTwo", AdventureReview = adventureReview},
                                             new AdventureDataCard {Id = "dataCardThree", AdventureReview = adventureReview}
                                         };

            var expectedReviewDataCardsResponse = new AdventureDataCardGetResponse(getReviewDataCardsRequest) { DataCards = reviewDataCardList };

            var mock = new Mock<IAdventureDataCardRepository>();
            mock.Setup(a => a.GetAdventureDataCardsByReviewId(getReviewDataCardsRequest.AdventureReview.Id)).Returns(
                reviewDataCardList);

            var target = new AdventureDataCardService { AdventureDataCardRepository = mock.Object };

            var actual = target.OnGet(getReviewDataCardsRequest) as AdventureDataCardGetResponse;
            Assert.AreEqual(expectedReviewDataCardsResponse, actual);
        }