コード例 #1
0
        public void Draw_CallsInterractor(int count, CollectionDirection direction)
        {
            PileDrawRequest pileDrawRequest = new PileDrawRequest {
                DeckHash  = "deck",
                PileHash  = "pile",
                Count     = count,
                Direction = direction
            };
            var pileCardsInterractorMock = new Mock <IPileCardsInterractor>();
            var mapperMock = new Mock <IMapper>();

            mapperMock.Setup(x => x.Map <CreatePileResponse>(It.IsAny <Pile>()))
            .Returns(new CreatePileResponse());
            var repositoryMock = new Mock <IDeckRepository>();

            repositoryMock.Setup(x => x.GetDeck(pileDrawRequest.DeckHash)).Returns(new Deck());
            var hashidsMock = new Mock <IHashids>();
            var controller  = new PileOperationsController(pileCardsInterractorMock.Object, mapperMock.Object, repositoryMock.Object, hashidsMock.Object);

            var response = controller.Draw(pileDrawRequest).Result as OkObjectResult;

            Assert.NotNull(response);
            pileCardsInterractorMock.Verify(x => x.Draw(pileDrawRequest.Direction,
                                                        pileDrawRequest.DeckHash,
                                                        pileDrawRequest.PileHash,
                                                        pileDrawRequest.Count));
        }
コード例 #2
0
        public ActionResult <List <Card> > Draw(PileDrawRequest pileDrawRequest)
        {
            var cards = _pileCardsInterractor.Draw(pileDrawRequest.Direction,
                                                   pileDrawRequest.DeckHash,
                                                   pileDrawRequest.PileHash,
                                                   pileDrawRequest.Count);

            return(Ok(cards));
        }