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 VersionSorted() { PacketDownloader fd = downloader as PacketDownloader; Assert.IsNotNull(fd); PacketInfo[] ps = fd.Packets; for (int i = 0; i < ps.Length - 2; i++) { Assert.Greater(ps [i].Version, ps [i + 1].Version); } }
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); }
public void AllPacketsExist() { PacketDownloader fd = downloader as PacketDownloader; Assert.IsNotNull(fd); PacketInfo[] ps = fd.Packets; Assert.AreEqual(ps.Length, packetPath.Length); for (int i = 0; i < packetPath.Length; i++) { int index = Array.FindIndex <PacketInfo> (ps, new Predicate <PacketInfo> ((p) => { return(p.File.Name == packetPath [i]); })); Assert.GreaterOrEqual(index, 0); } }