Esempio n. 1
0
        public void Empty_list_when_no_torrents()
        {
            var engine = new Mock<IBitTorrentEngine>();
            engine.SetupGet(e => e.Managers).Returns(() => null);

            var action = new GetTorrents(engine.Object);
            var result = action.Execute();

            Assert.IsTrue(result != null);
            Assert.IsInstanceOf(typeof(JsonResult), result);
        }
Esempio n. 2
0
        public void Returns_valid_object_when_torrents()
        {
            var engine = new Mock<IBitTorrentEngine>();
            var manager = new Mock<ITorrentManager>();

            engine.SetupGet(e => e.Managers).Returns(new Dictionary<string, ITorrentManager>()
                                                         {{"abcd", manager.Object}});

            var action = new GetTorrents(engine.Object);
            var result = action.Execute();

            Assert.IsTrue(result != null);
            Assert.IsInstanceOf(typeof(JsonResult), result);
        }