private void SetupMainTab(NodeModelBase directoryModel) { LoadDirectorySize(directoryModel.FullPath); var filesCount = _fileService.GetFiles(directoryModel.FullPath).Count; var directoriesCount = _directoryService.GetChildDirectories(directoryModel.FullPath).Count; MainNodeInfoTabViewModel.Activate(directoryModel, true, filesCount, directoriesCount); }
public void TestProperties(string filePath, string extension, bool isDirectory, bool isImage) { _autoMocker .Setup <IFileSizeFormatter, string>(m => m.GetFormattedSize(Size)) .Returns(FormattedSize); _autoMocker .Setup <IFileSizeFormatter, string>(m => m.GetSizeAsNumber(Size)) .Returns(SizeAsNumber); _autoMocker .Setup <IPathService, string>(m => m.GetParentDirectory(filePath)) .Returns(ParentDirectory); _autoMocker .Setup <IPathService, string>(m => m.GetFileName(filePath)) .Returns(FileName); _autoMocker .Setup <IPathService, string>(m => m.GetExtension(filePath)) .Returns(extension); _autoMocker .Setup <IBitmapFactory, IBitmap>(m => m.Create(filePath)) .Returns(new Mock <IBitmap>().Object); var viewModel = _autoMocker.CreateInstance <MainNodeInfoTabViewModel>(); var nodeModel = new NodeModelBase { FullPath = filePath, CreatedDateTime = DateTime.Now, LastAccessDateTime = DateTime.Now.AddHours(1), LastModifiedDateTime = DateTime.Now.AddHours(2), }; viewModel.Activate(nodeModel, isDirectory, InnerFilesCount, InnerDirectoriesCount); viewModel.SetSize(Size); Assert.Equal(nodeModel.CreatedDateTime, viewModel.CreatedDateTime); Assert.Equal(nodeModel.LastAccessDateTime, viewModel.LastAccessDateTime); Assert.Equal(nodeModel.LastModifiedDateTime, viewModel.LastWriteDateTime); Assert.Equal(FormattedSize, viewModel.FormattedSize); Assert.Equal(SizeAsNumber, viewModel.FormattedSizeAsNumber); Assert.Equal(FileName, viewModel.Name); Assert.Equal(ParentDirectory, viewModel.Path); Assert.Equal(isDirectory, viewModel.IsDirectory); Assert.Equal(InnerFilesCount, viewModel.InnerFilesCount); Assert.Equal(InnerDirectoriesCount, viewModel.InnerDirectoriesCount); if (isImage) { Assert.NotNull(viewModel.ImageBitmap); } else { Assert.Null(viewModel.ImageBitmap); } }
public TransitionEndModel(NodeModelBase udsaetNodeModel) { Node = udsaetNodeModel; }
private void SetupMainTab(NodeModelBase directoryModel) { LoadDirectorySize(directoryModel.FullPath); MainNodeInfoTabViewModel.Activate(directoryModel, true); }
public override bool IsSatisfiedBy(NodeModelBase nodeModel) => _regexService.CheckIfMatches(nodeModel.Name, _regex, _isCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
public abstract bool IsSatisfiedBy(NodeModelBase nodeModel);
public override bool IsSatisfiedBy(NodeModelBase nodeModel) => nodeModel.Name.Contains(_text, _isCaseSensitive ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase);
public void TestProperties(string filePath, string extension, bool isDirectory, bool isImage) { var configuration = new ImagePreviewConfiguration { SupportedFormats = new List <string> { "png", "jpg" } }; var fileSizeFormatterMock = new Mock <IFileSizeFormatter>(); fileSizeFormatterMock .Setup(m => m.GetFormattedSize(Size)) .Returns(FormattedSize); fileSizeFormatterMock .Setup(m => m.GetSizeAsNumber(Size)) .Returns(SizeAsNumber); var pathServiceMock = new Mock <IPathService>(); pathServiceMock .Setup(m => m.GetParentDirectory(filePath)) .Returns(ParentDirectory); pathServiceMock .Setup(m => m.GetFileName(filePath)) .Returns(FileName); pathServiceMock .Setup(m => m.GetExtension(filePath)) .Returns(extension); var bitmapFactoryMock = new Mock <IBitmapFactory>(); bitmapFactoryMock .Setup(m => m.Create(filePath)) .Returns(new Mock <IBitmap>().Object); var viewModel = new MainNodeInfoTabViewModel(fileSizeFormatterMock.Object, pathServiceMock.Object, bitmapFactoryMock.Object, configuration); var nodeModel = new NodeModelBase { FullPath = filePath, CreatedDateTime = DateTime.Now, LastAccessDateTime = DateTime.Now.AddHours(1), LastModifiedDateTime = DateTime.Now.AddHours(2), }; viewModel.Activate(nodeModel, isDirectory); viewModel.SetSize(Size); Assert.Equal(nodeModel.CreatedDateTime, viewModel.CreatedDateTime); Assert.Equal(nodeModel.LastAccessDateTime, viewModel.LastAccessDateTime); Assert.Equal(nodeModel.LastModifiedDateTime, viewModel.LastWriteDateTime); Assert.Equal(FormattedSize, viewModel.FormattedSize); Assert.Equal(SizeAsNumber, viewModel.FormattedSizeAsNumber); Assert.Equal(FileName, viewModel.Name); Assert.Equal(ParentDirectory, viewModel.Path); Assert.Equal(isDirectory, viewModel.IsDirectory); if (isImage) { Assert.NotNull(viewModel.ImageBitmap); } else { Assert.Null(viewModel.ImageBitmap); } }
public void DeleteNode(NodeModelBase node) { Nodes.Remove(node); // TODO remove links here too, at some point }
public TransitionStartModel(NodeModelBase node) { Node = node; }
public override bool IsSatisfiedBy(NodeModelBase nodeModel) => true;