Ejemplo n.º 1
0
        public void Create_ShouldReturnAEditEventViewModelWithAnEmptyEventDefinition()
        {
            int expectedEventDefinitionId = 0;
            var eventRepository = new StubIEventDefinitionRepository();
            var authenticationService = new StubIAuthorizationService();

            var controller = new EventController(eventRepository, authenticationService);

            var result = controller.Create() as ViewResult;
            var model = result.Model as EditEventViewModel;

            Assert.IsNotNull(model);
            Assert.AreEqual(expectedEventDefinitionId, model.EventDefinitionId);
        }
Ejemplo n.º 2
0
        public void Edit_ShouldReturnAEditEventViewModelWithTheEventDefinitonData()
        {
            int expectedEventDefinitionId = 1;
            int organizerId = 1;
            var eventRepository = new StubIEventDefinitionRepository();
            var authenticationService = new StubIAuthorizationService();
            var eventDefinition = GetEventDefinition(expectedEventDefinitionId, organizerId);

            eventRepository.GetByIdInt32 = (eventDefinitionId) =>
            {
                return eventDefinition;
            };

            var identity = GetIdentity(organizerId);
            var controller = new EventController(eventRepository, authenticationService);
            controller.SetFakeContext();
            controller.AddSessionValue("CURRENT_LOGO", null);

            var result = controller.Edit(identity, expectedEventDefinitionId) as ViewResult;
            var model = result.Model as EditEventViewModel;

            Assert.IsNotNull(model);
            Assert.AreEqual(expectedEventDefinitionId, model.EventDefinitionId);
        }