Esempio n. 1
0
        public void CreateInstanceOfPresenter()
        {
            var mockedView         = new Mock <IAllGamesView>();
            var mockedGamesService = new Mock <IGamesService>();

            var presenter = new AllGamesPresenter(mockedView.Object, mockedGamesService.Object);

            Assert.That(presenter, Is.InstanceOf <Presenter <IAllGamesView> >());
        }
Esempio n. 2
0
        public void InitializeCorrectly_WhenParametersAreValid()
        {
            var mockedView         = new Mock <IAllGamesView>();
            var mockedGamesService = new Mock <IGamesService>();

            var presenter = new AllGamesPresenter(mockedView.Object, mockedGamesService.Object);

            Assert.That(presenter, Is.Not.Null);
        }
Esempio n. 3
0
        public void CallGamessServiceGetAllMethod_WhenViewsEventIsRaised()
        {
            var mockedView  = new Mock <IAllGamesView>();
            var mockedModel = new Mock <AllGamesModel>();

            mockedView.Setup(x => x.Model).Returns(mockedModel.Object);
            var mockedGamesService = new Mock <IGamesService>();

            mockedGamesService.Setup(x => x.GetAll()).Returns(new List <GameDetails>());
            var presenter = new AllGamesPresenter(mockedView.Object, mockedGamesService.Object);

            mockedView.Raise(x => x.GetGames += null, null, null);

            mockedGamesService.Verify(x => x.GetAll(), Times.Once);
        }