1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . IO ;
4
- using System . Linq ;
5
4
using System . Text ;
6
5
7
6
using GitVersion . Helpers ;
8
7
9
8
using LibGit2Sharp ;
10
9
11
- using NSubstitute ;
12
-
13
10
public class TestFileSystem : IFileSystem
14
11
{
15
12
Dictionary < string , string > fileSystem = new Dictionary < string , string > ( ) ;
@@ -95,88 +92,6 @@ public long GetLastDirectoryWrite(string path)
95
92
96
93
public IRepository GetRepository ( string gitDirectory )
97
94
{
98
- var repository = Substitute . For < IRepository > ( ) ;
99
- var tip = Substitute . For < Commit > ( ) ;
100
- tip . Committer . Returns ( new Signature ( "Asbjørn Ulsberg" , "[email protected] " , new DateTimeOffset ( 2015 , 11 , 10 , 13 , 37 , 0 , TimeSpan . FromHours ( 1 ) ) ) ) ;
101
- var commits = new Commits
102
- {
103
- tip
104
- } ;
105
- repository . Commits . QueryBy ( null ) . ReturnsForAnyArgs ( commits ) ;
106
- var head = Substitute . For < Branch > ( ) ;
107
- head . CanonicalName . Returns ( "refs/heads/master" ) ;
108
- tip . Sha . Returns ( "e7da1b19d03394896fb8da8916cd26f0efb1566f" ) ;
109
- head . Tip . Returns ( tip ) ;
110
- repository . Head . Returns ( head ) ;
111
- var branches = new Branches
112
- {
113
- { "master" , tip }
114
- } ;
115
-
116
- repository . Branches . Returns ( branches ) ;
117
- return repository ;
118
- }
119
-
120
-
121
- class Branches : BranchCollection
122
- {
123
- IList < Branch > branches ;
124
-
125
-
126
- public Branches ( )
127
- {
128
- this . branches = new List < Branch > ( ) ;
129
- }
130
-
131
-
132
- public override Branch this [ string name ]
133
- {
134
- get { return this . branches . FirstOrDefault ( b => b . Name == name ) ; }
135
- }
136
-
137
-
138
- public override Branch Add ( string name , Commit commit , bool allowOverwrite = false )
139
- {
140
- var branch = Substitute . For < Branch > ( ) ;
141
- branch . Name . Returns ( name ) ;
142
- branch . Tip . Returns ( commit ) ;
143
- this . branches . Add ( branch ) ;
144
- return branch ;
145
- }
146
-
147
-
148
- public override Branch Add ( string name , Commit commit , Signature signature , string logMessage = null , bool allowOverwrite = false )
149
- {
150
- return Add ( name , commit , allowOverwrite ) ;
151
- }
152
-
153
-
154
- public override IEnumerator < Branch > GetEnumerator ( )
155
- {
156
- return this . branches . GetEnumerator ( ) ;
157
- }
158
- }
159
-
160
- class Commits : List < Commit > , IQueryableCommitLog
161
- {
162
- public CommitSortStrategies SortedBy { get ; private set ; }
163
-
164
-
165
- public ICommitLog QueryBy ( CommitFilter filter )
166
- {
167
- throw new NotImplementedException ( ) ;
168
- }
169
-
170
-
171
- public Commit FindMergeBase ( Commit first , Commit second )
172
- {
173
- throw new NotImplementedException ( ) ;
174
- }
175
-
176
-
177
- public Commit FindMergeBase ( IEnumerable < Commit > commits , MergeBaseFindingStrategy strategy )
178
- {
179
- throw new NotImplementedException ( ) ;
180
- }
95
+ throw new NotImplementedException ( ) ;
181
96
}
182
97
}
0 commit comments