public void StartCommand_NoExceptionWhenInspect_InpectResultIsAddedToElementList() { // Arrange var returnFolderElement = new FolderElement("test"); _BusyIndicatorWindowStub.ExecuteAndWait(Arg.Any <string>(), Arg.Any <Func <FolderElement> >()) .Returns(returnFolderElement); _BusyIndicatorWindowStub.IsSuccessfullyExecuted.Returns(true); // Act _SizeCounterViewModel.StartCmd.Execute(null); // Assert Assert.AreEqual(1, _SizeCounterViewModel.ElementList.Count); Assert.AreSame(returnFolderElement, _SizeCounterViewModel.ElementList[0]); }
private void Start() { ElementList.Clear(); var message = Resources.Message_BusyIndicator_Title; var result = _BusyWindow.ExecuteAndWait(message, InspectDirectory); if (_BusyWindow.IsSuccessfullyExecuted == true) { ElementList.Add(result); result.IsExpanded = true; RefreshElementsVisibilities(); } else { MessageBox.Show( string.Format(Resources.Message_Error_ParsingDirectoryFailed, _BusyWindow.ExecutionException.Message), Resources.Message_ApplicationTitle, MessageBoxButton.OK, MessageBoxImage.Error); } }
public void InspectFor2ndTime_PreviousSettingsWereKept() { // Arrange // settings base on the initial element list _SizeCounterViewModel.SizeFilterValue = "2"; _SizeCounterViewModel.HighlightElements = true; _SizeCounterViewModel.HideSmallerElements = true; // settings for mocking the inspecting result var rootFolder = new FolderElement("root"); var fileElement1 = new FileElement("file1.log", OneMb); var fileElement2 = new FileElement("file2.log", 3 * OneMb); rootFolder.Add(fileElement1); rootFolder.Add(fileElement2); rootFolder.IsExpanded = false; _BusyIndicatorWindowStub.ExecuteAndWait(Arg.Any <string>(), Arg.Any <Func <FolderElement> >()) .Returns(rootFolder); _BusyIndicatorWindowStub.IsSuccessfullyExecuted.Returns(true); // Act _SizeCounterViewModel.StartCmd.Execute(null); // Assert Assert.AreSame(rootFolder, _SizeCounterViewModel.ElementList[0]); Assert.IsTrue(rootFolder.IsExpanded); // Verify the previous settings Assert.IsTrue(rootFolder.IsVisible); Assert.IsFalse(rootFolder.ShouldBeHighlighted); Assert.IsFalse(fileElement1.IsVisible); Assert.IsFalse(fileElement1.ShouldBeHighlighted); Assert.IsTrue(fileElement2.IsVisible); Assert.IsTrue(fileElement2.ShouldBeHighlighted); }