public void DataValid() { PacketDownloader fd = downloader as PacketDownloader; Assert.IsNotNull(fd); Dictionary <string, byte[]> .Enumerator e = dictNewestPacket.GetEnumerator(); while (e.MoveNext()) { string targetPath = e.Current.Key; byte[] bytes = e.Current.Value; IEnumerator enumerator = fd.ResourceTask(targetPath, (results, error) => { Assert.IsNotNull(results); Assert.AreEqual(bytes.Length, results.Length); Assert.IsTrue(string.IsNullOrEmpty(error)); for (int i = 0; i < bytes.Length; i++) { Assert.AreEqual(bytes [i], results [i]); } }); bool completed = enumerator.RunCoroutineWithoutYields(int.MaxValue); Assert.IsTrue(completed); } }
public void ReadError() { PacketDownloader fd = downloader as PacketDownloader; Assert.IsNotNull(fd); IEnumerator enumerator = fd.ResourceTask("NotExistFile.Dat", (bytes, error) => { Assert.IsNull(bytes); Assert.IsFalse(string.IsNullOrEmpty(error)); }); bool completed = enumerator.RunCoroutineWithoutYields(int.MaxValue); Assert.IsTrue(completed); }