示例#1
0
        public void Can_Update_Title()
        {
            // Arrange
            string title       = "New Event Series";
            string description = "This is a new Event Series";
            var    es          = new EventSeries(title, description);

            Assert.Equal("New Event Series", es.Title);

            // Act
            es.UpdateTitle("Updated Title");

            // Assert
            Assert.Equal("Updated Title", es.Title);
        }
示例#2
0
        public bool UpdateEventSeries(int eventSeriesId, string title, string description, out string response)
        {
            EventSeries toUpdate = EventSeries.Get(eventSeriesId);

            if (EventSeries.ValueIsInUseByIdForExpression(x => x.Title == title && x.Id != eventSeriesId))
            {
                response = $"Cannot update Event Series: Title is in use by another Series.";
                return(false);
            }
            try
            {
                toUpdate.UpdateTitle(title);
                toUpdate.UpdateDescription(description);
                Complete();
                response = "Event Series updated.";
                return(true);
            }
            catch (Exception ex)
            {
                response = ex.Message;
                return(false);
            }
        }