re-record GetAttachmentView test and compare result to Base64 encoded original (#2979)

This commit is contained in:
Eric Dahlvang 2019-11-19 09:09:06 -08:00 коммит произвёл Tom Laird-McConnell
Родитель b0bf38168a
Коммит 57e57e66f0
2 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -14,7 +15,7 @@ namespace Microsoft.Bot.Connector.Tests
public class AttachmentsTests : BaseTest
{
protected const string ConversationId = "B21UTEF8S:T03CWQ0QB:D2369CT7C";
[Fact]
public async Task UploadAttachmentAndGetAttachment()
{
@ -132,9 +133,7 @@ namespace Microsoft.Bot.Connector.Tests
var attachmentId = response.Id;
var stream = await client.Attachments.GetAttachmentAsync(attachmentId, "original");
// Workaround for TestFramework not saving/replaying binary content
// Instead, convert the expected output the same way that the TestRecorder converts binary content to string
var expectedAsString = new StreamReader(new MemoryStream(attachment.OriginalBase64)).ReadToEnd();
var expectedAsString = Convert.ToBase64String(attachment.OriginalBase64, Base64FormattingOptions.None);
var actualAsString = new StreamReader(stream).ReadToEnd();
Assert.Equal(expectedAsString, actualAsString);

Различия файлов скрыты, потому что одна или несколько строк слишком длинны