public static Activity CreateFrom(this IActivity activity, ICardBuilder cardBuilder) { Activity response = ((Activity)activity).CreateReply(); response.Attachments = cardBuilder.Build(); return(response); }
public static Task <ResourceResponse> SendActivityAsyncFromAdaptiveCard(this ITurnContext turnContext, ICardBuilder cardBuilder, CancellationToken cancellationToken = default, bool isCarousel = false) { var attachment = MessageFactory.Attachment(cardBuilder.Build()); if (isCarousel) { attachment.AttachmentLayout = AttachmentLayoutTypes.Carousel; } return(turnContext.SendActivityAsync(attachment, cancellationToken)); }
public void AddBasicCardElements_AllDataValid_ReturnsCard( int passCode, string name, string description, string type, string race, string imageUrl, string smallImageUrl) { _cardBuilder.AddBasicCardElements(passCode, name, description, type, race, imageUrl, smallImageUrl, _archetype); Assert.NotNull(_cardBuilder.Build()); }
/// <summary> /// Updates the cards and archetypes. /// </summary> /// <param name="URL">The URL.</param> /// <exception cref="DbUpdateException"></exception> /// <exception cref="DbUpdateConcurrencyException"></exception> public async Task UpdateCardsAndArchetypes(string URL) { _archetypes = _db.Archetypes.ToList(); _cards = _db.Cards.ToList(); string cardsData = await _cardsDataDownloader.DownloadCardsFromWebsite(URL); JToken cardsDataList = (JsonConvert.DeserializeObject <JArray>(cardsData)).First; foreach (JObject item in cardsDataList.Children <JObject>()) { if (_cardAlreadyExistInOurDatabase(item)) { continue; } string type = item.Value <string>("type").ToUpper(); Archetype archetype; if (item.GetValue("archetype").ToString() == string.Empty) { archetype = _getArchetype(Archetype.Default); } else { archetype = _getArchetype(item.Value <string>("archetype")); } if (type.Contains("MONSTER")) { _addMonsterProperties(type, archetype, item); } _addBasicCardProperties(item, archetype); _db.Cards.Add(_cardBuilder.Build()); } await _db.SaveChangesAsync(); }