~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/PackageManagement/Test/Src/Helpers/FakeFileService.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
using ICSharpCode.PackageManagement;
 
7
using ICSharpCode.SharpDevelop.Project;
 
8
 
 
9
namespace PackageManagement.Tests.Helpers
 
10
{
 
11
        public class FakeFileService : IPackageManagementFileService
 
12
        {
 
13
                public string PathPassedToRemoveFile;
 
14
                public string PathPassedToRemoveDirectory;
 
15
                
 
16
                MSBuildBasedProject project;
 
17
                
 
18
                public FakeFileService(MSBuildBasedProject project)
 
19
                {
 
20
                        this.project = project;
 
21
                }
 
22
                
 
23
                public void RemoveFile(string path)
 
24
                {
 
25
                        PathPassedToRemoveFile = path;
 
26
                        
 
27
                        RemoveFirstProjectItem();
 
28
                }
 
29
                
 
30
                public void RemoveDirectory(string path)
 
31
                {
 
32
                        PathPassedToRemoveDirectory = path;
 
33
                        
 
34
                        RemoveFirstProjectItem();
 
35
                }
 
36
                
 
37
                void RemoveFirstProjectItem()
 
38
                {
 
39
                        ProjectItem item = project.Items[0];
 
40
                        ProjectService.RemoveProjectItem(project, item);
 
41
                }
 
42
                
 
43
                public string FileNamePassedToOpenFile;
 
44
                
 
45
                public void OpenFile(string fileName)
 
46
                {
 
47
                        FileNamePassedToOpenFile = fileName;
 
48
                }
 
49
                
 
50
                public string OldFileNamePassedToCopyFile;
 
51
                public string NewFileNamePassedToCopyFile;
 
52
                
 
53
                public void CopyFile(string oldFileName, string newFileName)
 
54
                {
 
55
                        OldFileNamePassedToCopyFile = oldFileName;
 
56
                        NewFileNamePassedToCopyFile = newFileName;
 
57
                }
 
58
                
 
59
                public List<string> ExistingFileNames = new List<string>();
 
60
                
 
61
                public bool FileExists(string fileName)
 
62
                {
 
63
                        return ExistingFileNames.Contains(fileName);
 
64
                }
 
65
        }
 
66
}