Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Libgit2sharp
提交
b8196926
L
Libgit2sharp
项目概览
jobily
/
Libgit2sharp
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
Libgit2sharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b8196926
编写于
12月 13, 2010
作者:
N
nulltoken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added some infrastructure for running isolated tests which modify the content of a git repository.
上级
88bfc327
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
6 deletion
+72
-6
libgit2sharp.Tests/InstantiatingARepository.cs
libgit2sharp.Tests/InstantiatingARepository.cs
+1
-3
libgit2sharp.Tests/ReadOnlyRepositoryFixtureBase.cs
libgit2sharp.Tests/ReadOnlyRepositoryFixtureBase.cs
+7
-0
libgit2sharp.Tests/ReadWriteRepositoryFixtureBase.cs
libgit2sharp.Tests/ReadWriteRepositoryFixtureBase.cs
+61
-0
libgit2sharp.Tests/RepositoryFixtures.cs
libgit2sharp.Tests/RepositoryFixtures.cs
+1
-3
libgit2sharp.Tests/libgit2sharp.Tests.csproj
libgit2sharp.Tests/libgit2sharp.Tests.csproj
+2
-0
未找到文件。
libgit2sharp.Tests/InstantiatingARepository.cs
浏览文件 @
b8196926
...
...
@@ -5,10 +5,8 @@
namespace
libgit2sharp.Tests
{
[
TestFixture
]
public
class
InstantiatingARepository
public
class
InstantiatingARepository
:
ReadOnlyRepositoryFixtureBase
{
const
string
PathToRepository
=
"../../Resources/testrepo.git"
;
[
Test
]
public
void
ShouldThrowIfPassedANonValidGitDirectory
()
{
...
...
libgit2sharp.Tests/ReadOnlyRepositoryFixtureBase.cs
0 → 100644
浏览文件 @
b8196926
namespace
libgit2sharp.Tests
{
public
class
ReadOnlyRepositoryFixtureBase
{
protected
virtual
string
PathToRepository
{
get
{
return
"../../Resources/testrepo.git"
;
}
}
}
}
\ No newline at end of file
libgit2sharp.Tests/ReadWriteRepositoryFixtureBase.cs
0 → 100644
浏览文件 @
b8196926
using
System
;
using
System.IO
;
using
System.Reflection
;
using
NUnit.Framework
;
namespace
libgit2sharp.Tests
{
public
class
ReadWriteRepositoryFixtureBase
:
ReadOnlyRepositoryFixtureBase
{
private
const
string
TestRepositoriesDirectoryName
=
"TestRepos"
;
private
static
readonly
string
_testRepositoriesDirectoryPath
=
RetrieveTestRepositoriesDirectory
();
private
string
_pathToRepository
;
protected
override
string
PathToRepository
{
get
{
return
_pathToRepository
;
}
}
[
SetUp
]
public
void
Setup
()
{
// Create temporary working directory
string
workDirpath
=
Path
.
Combine
(
_testRepositoriesDirectoryPath
,
this
.
GetType
().
Name
,
Guid
.
NewGuid
().
ToString
().
Substring
(
0
,
8
));
var
source
=
new
DirectoryInfo
(
base
.
PathToRepository
);
var
tempRepository
=
new
DirectoryInfo
(
Path
.
Combine
(
workDirpath
,
source
.
Name
));
CopyFilesRecursively
(
source
,
tempRepository
);
_pathToRepository
=
tempRepository
.
FullName
;
}
[
TestFixtureTearDown
]
public
void
TestFixtureTearDown
()
{
Directory
.
Delete
(
_testRepositoriesDirectoryPath
,
true
);
}
public
static
void
CopyFilesRecursively
(
DirectoryInfo
source
,
DirectoryInfo
target
)
{
// From http://stackoverflow.com/questions/58744/best-way-to-copy-the-entire-contents-of-a-directory-in-c/58779#58779
foreach
(
DirectoryInfo
dir
in
source
.
GetDirectories
())
CopyFilesRecursively
(
dir
,
target
.
CreateSubdirectory
(
dir
.
Name
));
foreach
(
FileInfo
file
in
source
.
GetFiles
())
file
.
CopyTo
(
Path
.
Combine
(
target
.
FullName
,
file
.
Name
));
}
static
private
string
RetrieveTestRepositoriesDirectory
()
{
return
Path
.
Combine
(
RetrieveAssemblyDirectory
(),
TestRepositoriesDirectoryName
);
}
static
private
string
RetrieveAssemblyDirectory
()
{
// From http://stackoverflow.com/questions/52797/c-how-do-i-get-the-path-of-the-assembly-the-code-is-in/283917#283917
string
codeBase
=
Assembly
.
GetExecutingAssembly
().
CodeBase
;
var
uri
=
new
UriBuilder
(
codeBase
);
string
path
=
Uri
.
UnescapeDataString
(
uri
.
Path
);
return
Path
.
GetDirectoryName
(
path
);
}
}
}
\ No newline at end of file
libgit2sharp.Tests/RepositoryFixtures.cs
浏览文件 @
b8196926
...
...
@@ -5,10 +5,8 @@
namespace
libgit2sharp.Tests
{
[
TestFixture
]
public
class
RepositoryFixtures
public
class
RepositoryFixtures
:
ReadOnlyRepositoryFixtureBase
{
const
string
PathToRepository
=
"../../Resources/testrepo.git"
;
[
Test
]
public
void
Ctor_RetrieveDetails
()
{
...
...
libgit2sharp.Tests/libgit2sharp.Tests.csproj
浏览文件 @
b8196926
...
...
@@ -45,6 +45,8 @@
<ItemGroup>
<Compile
Include=
"GitDateFixture.cs"
/>
<Compile
Include=
"ObjectIdFixture.cs"
/>
<Compile
Include=
"ReadOnlyRepositoryFixtureBase.cs"
/>
<Compile
Include=
"ReadWriteRepositoryFixtureBase.cs"
/>
<Compile
Include=
"RepositoryFixtures.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"InstantiatingARepository.cs"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录