public void GetBase64StringTest() { { var result = StreamUtility.GetBase64String(GetStream(str)); Assert.AreEqual(baseString, result); } #region 测试异步方法 Console.WriteLine("=== 测试异步方法 ==="); Task.Run(async() => { var result = await StreamUtility.GetBase64StringAsync(GetStream(str)); Assert.AreEqual(baseString, result); Console.WriteLine("=== 异步完成 ==="); }).GetAwaiter().GetResult(); #endregion }