コード例 #1
0
        public void Draw_CallsHelperAndRepository(CollectionDirection direction)
        {
            var helperMock     = new Mock <ICardsHelper>();
            var repositoryMock = new Mock <IDeckRepository>();

            repositoryMock.Setup(x => x.GetDeck(It.IsAny <string>()))
            .Returns(new Deck {
                Piles = new List <Pile> {
                    new Pile {
                        Hash  = "First",
                        Cards = new List <Card>()
                    }
                }
            });

            var hashidsMock = new Mock <IHashids>();

            var interractor = new PileCardsInterractor(repositoryMock.Object, helperMock.Object, hashidsMock.Object);

            interractor.Draw(direction, It.IsAny <string>(), "First", 1);

            repositoryMock.Verify(x => x.GetDeck(It.IsAny <string>()));
            helperMock.Verify(x => x.Draw(direction, It.IsAny <List <Card> >(), 1));
            repositoryMock.Verify(x => x.Update(It.IsAny <Deck>()));
        }