コード例 #1
0
        public void Volunters_EventVolunterRegistrationisOpen_SingleTask_PassTasksToView()
        {
            _serviceMock.Setup(serv => serv.GetAllCurrentEventTasks(It.IsAny<int>())).Returns(() => new Task[] { GetTestTask(true) });
            _cut = new HomeController(_serviceMock.Object, new CodeCampServiceRepository(_serviceMock.Object));

            var view = _cut.Volunteers(1);
            Assert.IsTrue(_cut.ViewData.Model.GetType() == typeof(List<VolunteerTask>));
            Assert.AreEqual(1, ((List<VolunteerTask>)_cut.ViewData.Model).Count);
        }
コード例 #2
0
        public void Volunteers_NoTasksReturned_PassEmptyModelToView()
        {
            _serviceMock.Setup(serv => serv.GetAllCurrentEventTasks(It.IsAny<int>())).Returns(() => new Task[] { });
            _cut = new HomeController(_serviceMock.Object, new CodeCampServiceRepository(_serviceMock.Object));

            var view = _cut.Volunteers(1);
            Assert.IsTrue(_cut.ViewData.Model.GetType() == typeof(List<VolunteerTask>));
            Assert.AreEqual(0, ((List<VolunteerTask>)_cut.ViewData.Model).Count);
        }