Exemple #1
0
        public void UpdateSportEventReturnsFalseOnFailedUpdatingSportEvent()
        {
            //Arrange
            var events            = List();
            var updatedSportEvent = new SportEvent
            {
                SportEventId = 324,             //id does not exist
                Description  = "Test",
                MaxAttendees = 10,
                MinAttendees = 5
            };


            var mockRepo = new Mock <ISportEventRepository>();

            mockRepo.Setup(a => a.GetAllEvents()).Returns(events);
            mockRepo.Setup(a => a.UpdateSportEvent(It.IsAny <SportEvent>()));
            var manager = new SportEventManager(mockRepo.Object);

            //Act
            var result = manager.EditSportEvent(updatedSportEvent);

            //Assert
            Assert.False(result);
        }
Exemple #2
0
        public void UpdateSportEventReturnsTrueOnSuccessfullyUpdatingSportEvent()
        {
            //Arrange
            var events            = List();
            var updatedSportEvent = new SportEvent
            {
                SportEventId = 2,             //Existing item ID
                Description  = "Test",
                MaxAttendees = 10,
                MinAttendees = 5
            };


            var mockRepo = new Mock <ISportEventRepository>();

            mockRepo.Setup(a => a.GetAllEvents()).Returns(events);
            mockRepo.Setup(a => a.UpdateSportEvent(It.IsAny <SportEvent>()));
            var manager = new SportEventManager(mockRepo.Object);

            //Act
            var result = manager.EditSportEvent(updatedSportEvent);

            //Assert
            Assert.True(result);
        }