Example #1
0
        /// <summary>
        /// Sends cancellation notification to the registered users for an event
        /// </summary>
        /// <param name="teamId">The LnD team Id</param>
        /// <param name="eventId">The event Id for which notification to send</param>
        /// <returns>Returns true if notification sent successfully. Else returns false.</returns>
        private async Task <bool> SendCancellationNotificationAsync(string teamId, string eventId)
        {
            var eventDetails = await this.eventRepository.GetEventDetailsAsync(eventId, teamId);

            if (eventDetails == null || eventDetails.RegisteredAttendeesCount == 0)
            {
                return(false);
            }

            List <string> users = new List <string>();

            if (!string.IsNullOrEmpty(eventDetails.RegisteredAttendees))
            {
                users.AddRange(eventDetails.RegisteredAttendees.Split(";"));
            }

            if (!string.IsNullOrEmpty(eventDetails.AutoRegisteredAttendees))
            {
                users.AddRange(eventDetails.AutoRegisteredAttendees.Split(";"));
            }

            await this.categoryHelper.BindCategoryNameAsync(new List <EventEntity>() { eventDetails });

            var registeredAttendees = await this.userConfigurationRepository.GetUserConfigurationsAsync(users);

            var notificationCard = EventCancellationCard.GetCancellationCard(this.localizer, eventDetails, this.botOptions.Value.ManifestId);

            await this.notificationHelper.SendNotificationToUsersAsync(registeredAttendees, notificationCard);

            return(true);
        }
        public void GetCard()
        {
            var Results = EventCancellationCard.GetCancellationCard(localizer.Object, EventWorkflowHelperData.validEventEntity, "random");

            Assert.AreEqual(Results.ContentType, AdaptiveCard.ContentType);
        }