예제 #1
0
        public void Announces_None()
        {
            var editor = new TorrentEditor(new BEncodedDictionary());
            var result = editor.ToDictionary();

            Assert.IsFalse(result.ContainsKey("announce"), "#1");
            Assert.IsFalse(result.ContainsKey("announce-list"), "#2");
        }
예제 #2
0
        public void EditComment()
        {
            var d      = Create("comment", "a");
            var editor = new TorrentEditor(d);

            editor.Comment = "b";
            d = editor.ToDictionary();
            Assert.AreEqual("b", d ["comment"].ToString(), "#1");
        }
예제 #3
0
        public void Announces_Single()
        {
            var editor = new TorrentEditor(new BEncodedDictionary())
            {
                Announce = "udp://test.com/announce"
            };
            var result = editor.ToDictionary();

            Assert.IsTrue(result.ContainsKey("announce"), "#1");
            Assert.IsFalse(result.ContainsKey("announce-list"), "#2");
        }
예제 #4
0
        public void EditComment_null()
        {
            var d      = Create("comment", "a");
            var editor = new TorrentEditor(d)
            {
                Comment = null
            };

            d = editor.ToDictionary();
            Assert.IsFalse(d.ContainsKey("comment"), "#1");
            Assert.IsNull(editor.Comment, "#2");
        }
예제 #5
0
        public void Announces_OneTier()
        {
            var tier = new RawTrackerTier {
                "http://test.com/announce"
            };
            var editor = new TorrentEditor(new BEncodedDictionary());

            editor.Announces.Add(tier);

            var result = editor.ToDictionary();

            Assert.IsFalse(result.ContainsKey("announce"), "#1");
            Assert.IsTrue(result.ContainsKey("announce-list"), "#2");
        }
예제 #6
0
        public void Announces_OneTierThenRemove()
        {
            var tier = new List <string> {
                "http://test.com/announce"
            };
            var editor = new TorrentEditor(new BEncodedDictionary());

            editor.Announces.Add(tier);

            editor = new TorrentEditor(editor.ToDictionary());
            editor.Announces.Clear();

            var result = editor.ToDictionary();

            Assert.IsFalse(result.ContainsKey("announce"), "#1");
            Assert.IsFalse(result.ContainsKey("announce-list"), "#2");
        }