public void Large_binary_throws() { // Arrange var content = new byte[31 * 1024 * 1024]; var fileName = "LargeFile.txt"; // Act var result = Should.Throw <Exception>(() => SendGridAttachment.FromBinary(content, fileName)); // Assert result.Message.ShouldBe("Attachment exceeds the size limit"); }
public void Small_binary_attachment() { // Arrange var content = Encoding.UTF8.GetBytes("Hello World!"); var fileName = "SmallFile.txt"; // Act var result = SendGridAttachment.FromBinary(content, fileName); // Assert result.Content = Convert.ToBase64String(content); result.ContentId = null; result.Disposition = "attachment"; result.FileName = "SmallFile.txt"; result.Type = "text/plain"; }