Exemplo n.º 1
0
        public void TestCreate(string searchText, string fullPath, SuggestedPathType suggestedPathType,
                               string relativePath, string parentDir, SuggestionType suggestionType)
        {
            _autoMocker
            .Setup <IPathService, string>(m => m.GetParentDirectory(searchText))
            .Returns(parentDir);
            _autoMocker
            .Setup <IPathService, string>(m => m.GetRelativePath(parentDir, fullPath))
            .Returns(relativePath);
            _autoMocker
            .Setup <IPathService, string>(m => m.LeftTrimPathSeparators(relativePath))
            .Returns(relativePath);

            var factory   = _autoMocker.CreateInstance <SuggestedPathViewModelFactory>();
            var model     = new SuggestionModel(fullPath, suggestionType);
            var viewModel = factory.Create(searchText, model);

            Assert.NotNull(viewModel);
            Assert.IsType <SuggestedPathViewModel>(viewModel);

            var suggestedPathViewModel = (SuggestedPathViewModel)viewModel;

            Assert.Equal(suggestedPathType, suggestedPathViewModel.Type);
            Assert.Equal(relativePath, suggestedPathViewModel.Text);
            Assert.Equal(fullPath, suggestedPathViewModel.FullPath);
        }
Exemplo n.º 2
0
        public void TestProperties(string fullPath, SuggestedPathType type, string text)
        {
            var viewModel = new SuggestedPathViewModel(fullPath, type, text);

            Assert.Equal(fullPath, viewModel.FullPath);
            Assert.Equal(type, viewModel.Type);
            Assert.Equal(text, viewModel.Text);
        }
Exemplo n.º 3
0
 public SuggestedPathViewModel(string fullPath, SuggestedPathType type, string text)
 {
     FullPath = fullPath;
     Type     = type;
     Text     = text;
 }