public void Handle_WithPutCommand_CallsPutAPI() { const string testFilePath = "TestFilePath"; var expectedFileStatus = new CdfsFileStatus(); var expectedFileList = new List <CdfsFileStatus>() { expectedFileStatus }; // Arrange var stubClientProtocol = new Mock <IRestClientProtocol>(); var mockConsole = new Mock <IConsole>(); var sut = new ListingCommandHandler(stubClientProtocol.Object, mockConsole.Object); var listingCommand = new ListingCommand() { FilePath = testFilePath }; stubClientProtocol.Setup(x => x.GetListing(testFilePath)).Returns(expectedFileList); // Act sut.Handle(listingCommand); // Assert mockConsole.Verify(x => x.WriteLine(expectedFileStatus)); }
//private DxxUrl CreateDxxUrl() { // var driver = Driver.Value; // var uri = new Uri(Url.Value); // return new DxxUrl(uri, driver, driver.GetNameFromUri(uri, "link"), IsMain ? "from main" : "from sub"); //} private void InitializeCommands() { GoBackCommand.Subscribe(() => { GoBack(); }); GoForwardCommand.Subscribe(() => { GoForward(); }); ReloadCommand.Subscribe(() => { Reload(); }); StopCommand.Subscribe(() => { Stop(); }); BookmarkCommand.Subscribe((v) => { if (string.IsNullOrEmpty(v) || !v.StartsWith("http")) { IsBookmarked.Value = false; return; } if (IsBookmarked.Value) { Bookmarks.Value.AddBookmark("", v); } else { Bookmarks.Value.RemoveBookmark(v); Url.Value = v; } }); NavigateCommand.Subscribe((v) => { Navigate(v); }); ClearURLCommand.Subscribe((v) => { Url.Value = ""; }); AnalyzeCommand.Subscribe((v) => { if (v == null) { v = Url.Value; } var aw = new DxxAnalysisWindow(v); //aw.Owner = Owner; aw.Show(); }); CopyCommand.Subscribe((v) => { Clipboard.SetData(DataFormats.Text, v); }); DownloadCommand.Subscribe(() => { if (IsTarget.Value || IsContainer.Value) { DxxDriverManager.Instance.Download(Url.Value, null, ""); } }); ListingCommand.Subscribe(async() => { if (IsContainerList.Value) { var uri = new Uri(Url.Value); var dxxUrl = new DxxUrl(uri, Driver.Value, Driver.Value.GetNameFromUri(uri), ""); var targets = await Driver.Value.LinkExtractor.ExtractTargets(dxxUrl); if (targets != null && targets.Count > 0) { TargetList.Value = new ObservableCollection <DxxTargetInfo>(targets); } else { TargetList.Value?.Clear(); } } }); SetupDriverCommand.Subscribe(() => { DxxDriverManager.Instance.Setup(Driver.Value, Owner); }); FrameSelectCommand.Subscribe((v) => { if (IsMain) { RequestLoadInSubview.OnNext(v); } else { Navigate(v); } }); }