コード例 #1
0
        public void CreatingTwoTransmissionProducesTwoEntriesInList()
        {
            var underTest = new TransmissionManager();

            underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path");
            underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path2");

            Assert.That(underTest.ActiveTransmissions.Count, Is.EqualTo(2));
        }
コード例 #2
0
        public void ListedTransmissionIsEqualToAdded()
        {
            var underTest = new TransmissionManager();
            var trans     = underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path");

            Assert.That(underTest.ActiveTransmissions[0], Is.EqualTo(trans));
            Assert.That(underTest.ActiveTransmissionsAsList()[0], Is.EqualTo(trans));
        }
コード例 #3
0
        public void CreatingASingleTransmissionIncreasesListCountByOne()
        {
            var underTest = new TransmissionManager();

            underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path");

            Assert.That(underTest.ActiveTransmissions.Count, Is.EqualTo(1));
        }
コード例 #4
0
        public void AnAbortedTransmissionIsRemovedFromList()
        {
            var underTest = new TransmissionManager();
            var trans     = underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path");

            trans.Status = TransmissionStatus.ABORTED;

            Assert.That(underTest.ActiveTransmissions, Is.Empty);
        }
コード例 #5
0
        public void AFinishedTransmissionFiresEvent()
        {
            var underTest    = new TransmissionManager();
            var trans        = underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path");
            int eventCounter = 0;

            underTest.ActiveTransmissions.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) {
                eventCounter++;
                Assert.That(e.NewItems, Is.Null);
                Assert.That(e.OldItems.Count, Is.EqualTo(1));
                Assert.That(e.OldItems[0], Is.EqualTo(trans));
            };
            trans.Status = TransmissionStatus.FINISHED;

            Assert.That(eventCounter, Is.EqualTo(1));
        }
コード例 #6
0
        public void CreatingATransmissionFiresEvent()
        {
            var underTest = new TransmissionManager();

            int    eventCounter = 0;
            string path         = "path";

            underTest.ActiveTransmissions.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) {
                eventCounter++;
                Assert.That(e.NewItems.Count, Is.EqualTo(1));
                Assert.That((e.NewItems[0] as Transmission).Type, Is.EqualTo(TransmissionType.DOWNLOAD_NEW_FILE));
                Assert.That((e.NewItems[0] as Transmission).Path, Is.EqualTo(path));
            };

            underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, path);

            Assert.That(eventCounter, Is.EqualTo(1));
        }
コード例 #7
0
            public byte[] Upload(IFileInfo localFile, IDocument doc, TransmissionManager transmissionManager)
            {
                var transmission = transmissionManager.CreateTransmission(TransmissionType.UPLOAD_MODIFIED_FILE, localFile.FullName);

                return(this.UploadFile(localFile, doc, transmission));
            }