コード例 #1
0
        public void AsyncCancel()
        {
            var cts = new CancellationTokenSource();

            cts.Cancel();

            var fileSource = new TorrentFileSource(typeof(TorrentCreatorTests).Assembly.Location);

            Assert.ThrowsAsync <OperationCanceledException> (() => creator.CreateAsync(fileSource, cts.Token));
        }
コード例 #2
0
        public void AutoSelectPieceLength()
        {
            var torrentCreator = new TorrentCreator(TestFactories);

            Assert.DoesNotThrowAsync(() => torrentCreator.CreateAsync("name", files, CancellationToken.None));
        }