1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.SvnHooks
.Tests
18 using System
.Collections
;
21 using Castle
.SvnHooks
;
24 /// Summary description for MockRepository.
26 public class MockRepository
: IRepository
28 public MockRepository()
32 public void AddFile(String path
, String author
, IDictionary properties
, String contents
)
34 byte[] byteContents
= null;
37 byteContents
= Encoding
.ASCII
.GetBytes(contents
);
40 Files
.Add(path
, new File(path
, author
, properties
, byteContents
));
43 #region IRepository Members
45 public string[] GetProperty(string path
, string property
)
47 File file
= Files
[path
] as File
;
48 if (file
== null || file
.Properties
== null)
51 return (String
[])file
.Properties
[property
];
54 public System
.IO
.Stream
GetFileContents(string path
)
56 File file
= Files
[path
] as File
;
57 if (file
== null || file
.Contents
== null)
60 return new System
.IO
.MemoryStream(file
.Contents
, false);
66 private readonly IDictionary Files
= new Hashtable();
70 public File(String path
, String author
, IDictionary properties
, byte[] contents
)
72 this.properties
= properties
;
73 this.contents
= contents
;
76 public IDictionary Properties
78 get { return properties; }
80 public byte[] Contents
82 get { return contents; }
85 private IDictionary properties
;
86 private byte[] contents
;