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

            Assert.Equal("This is a new Event Series", es.Description);

            // Act
            es.UpdateDescription("This is an updated description.");

            // Assert
            Assert.Equal("This is an updated description.", es.Description);
        }
예제 #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);
            }
        }