protected void ConvertNotSupportedCardTest() { var attachment = new NotSupportedCard().ToAttachment().Anonymize(); Assert.IsNotType <NotSupportedCard>(attachment.Content); var converter = GetConverter(); Assert.False(converter.ConvertAttachmentContent(attachment)); Assert.IsNotType <NotSupportedCard>(attachment.Content); }
protected void BadTypeThrowsTest(string doppelgangerType) { var attachment = new NotSupportedCard().ToAttachment(); // This has a Title property of a different type from the HeroCard. attachment.ContentType = doppelgangerType; // mangle the content type. // Type remains unchanged so far. Assert.IsType <NotSupportedCard>(attachment.Content); attachment = attachment.Anonymize(); // After anonymizing type is lost. Assert.IsNotType <NotSupportedCard>(attachment.Content); var converter = GetConverter(); // Exception is thrown. Assert.Throws <ValidationException>(() => converter.ConvertAttachmentContent(attachment)); }
public static Attachment ToAttachment(this NotSupportedCard card) => CreateAttachment(card, NotSupportedCard.ContentType);