コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
            }
        }