public async Task GetFile_Test() { var sut = CreateSystemUnderTest(); string jsonReturn = "ThisIsATestByteArray"; var byteData = Encoding.UTF8.GetBytes(jsonReturn); contentApiSubstitute.GetResponseFromUrlAsBytes(null).ReturnsForAnyArgs(byteData); var file = await sut.GetFile(42); Assert.AreEqual(42, file.MediaId); var data = file.Data; Assert.AreEqual(84, data[0]); Assert.AreEqual(104, data[1]); Assert.AreEqual(105, data[2]); Assert.AreEqual(115, data[3]); Assert.AreEqual(73, data[4]); Assert.AreEqual(115, data[5]); Assert.AreEqual(65, data[6]); Assert.AreEqual(84, data[7]); Assert.AreEqual(101, data[8]); Assert.AreEqual(115, data[9]); Assert.AreEqual(116, data[10]); Assert.AreEqual(66, data[11]); Assert.AreEqual(121, data[12]); Assert.AreEqual(116, data[13]); Assert.AreEqual(101, data[14]); Assert.AreEqual(65, data[15]); Assert.AreEqual(114, data[16]); Assert.AreEqual(114, data[17]); Assert.AreEqual(97, data[18]); Assert.AreEqual(121, data[19]); }
public async Task <FileDto> GetFile(int mediaId) { string requestPath = $@"/Media/{mediaId}/File"; var response = await contentApiClient.GetResponseFromUrlAsBytes(requestPath); return(new FileDto { Data = response, MediaId = mediaId }); }