Exemplo n.º 1
0
        public void CreateInstance_WhenParametersAreValid()
        {
            var viewMock          = new Mock <ILeagueTableView>();
            var leagueServiceMock = new Mock <ILeagueTableService>();

            LeagueTablePresenter presenter = new LeagueTablePresenter(viewMock.Object, leagueServiceMock.Object);

            Assert.IsInstanceOf <LeagueTablePresenter>(presenter);
        }
        public void SetLeagueTableToViewModel_WhenView_OnGetLeaguesTableIsRaised()
        {
            var viewMock          = new Mock <ILeagueTableView>();
            var leagueServiceMock = new Mock <ILeagueTableService>();

            LeagueTable leagueTable = new LeagueTable();

            leagueServiceMock.Setup(x => x.GetLeagueTableById(It.IsAny <int>())).Returns(leagueTable);

            LeagueTablesViewModel model = new LeagueTablesViewModel();

            viewMock.Setup(x => x.Model).Returns(model);
            LeagueTablePresenter presenter = new LeagueTablePresenter(viewMock.Object, leagueServiceMock.Object);


            viewMock.Raise(x => x.OnGetLeagueTableData += null, new IdEventArgs(8));

            Assert.AreEqual(leagueTable, viewMock.Object.Model.LeagueTable);
        }