public void Setup() { _settings = new DownloadStationSettings() { Host = "127.0.0.1", Port = 5000, Username = "******", Password = "******" }; Subject.Definition = new DownloadClientDefinition(); Subject.Definition.Settings = _settings; _queued = new DownloadStationTask() { Id = "id1", Size = 1000, Status = DownloadStationTaskStatus.Waiting, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "0" }, { "size_uploaded", "0" }, { "speed_download", "0" } } } }; _completed = new DownloadStationTask() { Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Finished, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "size_uploaded", "100" }, { "speed_download", "0" } }, } }; _seeding = new DownloadStationTask() { Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Seeding, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "size_uploaded", "100" }, { "speed_download", "0" } } } }; _downloading = new DownloadStationTask() { Id = "id3", Size = 1000, Status = DownloadStationTaskStatus.Downloading, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "100" }, { "size_uploaded", "10" }, { "speed_download", "50" } } } }; _failed = new DownloadStationTask() { Id = "id4", Size = 1000, Status = DownloadStationTaskStatus.Error, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "10" }, { "size_uploaded", "1" }, { "speed_download", "0" } } } }; _singleFile = new DownloadStationTask() { Id = "id5", Size = 1000, Status = DownloadStationTaskStatus.Seeding, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "a.mkv", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "size_uploaded", "100" }, { "speed_download", "0" } } } }; _multipleFiles = new DownloadStationTask() { Id = "id6", Size = 1000, Status = DownloadStationTaskStatus.Seeding, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "size_uploaded", "100" }, { "speed_download", "0" } } } }; _singleFileCompleted = new DownloadStationTask() { Id = "id6", Size = 1000, Status = DownloadStationTaskStatus.Finished, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "a.mkv", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "size_uploaded", "100" }, { "speed_download", "0" } } } }; _multipleFilesCompleted = new DownloadStationTask() { Id = "id6", Size = 1000, Status = DownloadStationTaskStatus.Finished, Type = DownloadStationTaskType.BT.ToString(), Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", DownloadURL } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "size_uploaded", "100" }, { "speed_download", "0" } } } }; Mocker.GetMock <ITorrentFileInfoReader>() .Setup(s => s.GetHashFromTorrentFile(It.IsAny <byte[]>())) .Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951"); Mocker.GetMock <IHttpClient>() .Setup(s => s.Get(It.IsAny <HttpRequest>())) .Returns <HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0])); _downloadStationConfigItems = new Dictionary <string, object> { { "default_destination", _defaultDestination }, }; Mocker.GetMock <IDownloadStationInfoProxy>() .Setup(v => v.GetConfig(It.IsAny <DownloadStationSettings>())) .Returns(_downloadStationConfigItems); }
public void Setup() { _remoteEpisode = CreateRemoteEpisode(); _settings = new DownloadStationSettings() { Host = "127.0.0.1", Port = 5000, Username = "******", Password = "******" }; Subject.Definition = new DownloadClientDefinition(); Subject.Definition.Settings = _settings; _queued = new DownloadStationTask() { Id = "id1", Size = 1000, Status = DownloadStationTaskStatus.Waiting, Type = DownloadStationTaskType.NZB, Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", FileNameBuilder.CleanFileName(_remoteEpisode.Release.Title) + ".nzb" } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "0" }, { "speed_download", "0" } } } }; _completed = new DownloadStationTask() { Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Finished, Type = DownloadStationTaskType.NZB, Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", FileNameBuilder.CleanFileName(_remoteEpisode.Release.Title) + ".nzb" } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "speed_download", "0" } }, } }; _seeding = new DownloadStationTask() { Id = "id2", Size = 1000, Status = DownloadStationTaskStatus.Seeding, Type = DownloadStationTaskType.NZB, Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", FileNameBuilder.CleanFileName(_remoteEpisode.Release.Title) + ".nzb" } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "1000" }, { "speed_download", "0" } } } }; _downloading = new DownloadStationTask() { Id = "id3", Size = 1000, Status = DownloadStationTaskStatus.Downloading, Type = DownloadStationTaskType.NZB, Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", FileNameBuilder.CleanFileName(_remoteEpisode.Release.Title) + ".nzb" } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "100" }, { "speed_download", "50" } } } }; _failed = new DownloadStationTask() { Id = "id4", Size = 1000, Status = DownloadStationTaskStatus.Error, Type = DownloadStationTaskType.NZB, Username = "******", Title = "title", Additional = new DownloadStationTaskAdditional { Detail = new Dictionary <string, string> { { "destination", "shared/folder" }, { "uri", FileNameBuilder.CleanFileName(_remoteEpisode.Release.Title) + ".nzb" } }, Transfer = new Dictionary <string, string> { { "size_downloaded", "10" }, { "speed_download", "0" } } } }; Mocker.GetMock <IHttpClient>() .Setup(s => s.Get(It.IsAny <HttpRequest>())) .Returns <HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0])); _downloadStationConfigItems = new Dictionary <string, object> { { "default_destination", _defaultDestination }, }; Mocker.GetMock <IDownloadStationProxy>() .Setup(v => v.GetConfig(It.IsAny <DownloadStationSettings>())) .Returns(_downloadStationConfigItems); }