示例#1
0
        public void CreateSingleFromFolder()
        {
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            BEncodedDictionary         dict     = creator.Create(new TorrentFileSource(assembly.Location));

            Torrent t = Torrent.Load(dict);

            Assert.AreEqual(1, t.Files.Length, "#1");
            Assert.AreEqual(Path.GetFileName(assembly.Location), t.Name, "#2");
            Assert.AreEqual(Path.GetFileName(assembly.Location), t.Files[0].Path, "#3");

            // Create it again
            creator.Create(new TorrentFileSource(assembly.Location));
        }
示例#2
0
        public void CreateMultiTest()
        {
            foreach (var v in announces)
            {
                creator.Announces.Add(v);
            }

            BEncodedDictionary dict    = creator.Create("TorrentName", files);
            Torrent            torrent = Torrent.Load(dict);

            VerifyCommonParts(torrent);
            for (int i = 0; i < torrent.Files.Length; i++)
            {
                Assert.IsTrue(files.Exists(delegate(TorrentFile f) { return(f.Equals(torrent.Files[i])); }));
            }
        }