小编Owa*_*ams的帖子

在交互式rebase提交消息中转义#字符

在git中执行交互式rebase后,我希望有一个以#(hash或pound)字符开头的提交消息,但以#开头的行#被视为注释并被忽略.

有没有办法逃脱#角色,使我的提交消息实际上以一个开头#

更多细节

我正在使用以下方式执行交互式rebase:

git rebase -i HEAD~4
Run Code Online (Sandbox Code Playgroud)

然后,在编辑器中我正在做任何需要的事情,例如:

pick b010299 #91691 Add test for logging in with valid credentials
reword 5e9159d 91691 Implement log-in feature
pick 2735aa3 #91691 Re-factor logic
pick 14bd500 #91691 Tidy up 'using' declarations

# Rebase 60d6e3f..14bd500 onto 60d6e3f
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for …
Run Code Online (Sandbox Code Playgroud)

git

8
推荐指数
1
解决办法
2111
查看次数

AutoFixture 自定义与构建

我知道我可以使用AutoFixture创建一个自动模拟的实例

var person = fixture.Create<Person>();
Run Code Online (Sandbox Code Playgroud)

但是,如果我想自定义 aPerson的创建方式,我有几个选择。一种是用Build

var person = fixture.Build<Person>()
                    .With(x => x.FirstName, "Owain")
                    .Create();
Run Code Online (Sandbox Code Playgroud)

另一个是使用 Customize

fixture.Customize<Person>(c => c.With(x => x.FirstName, "Owain"));
var person = fixture.Create<Person>();
Run Code Online (Sandbox Code Playgroud)

所以,我的问题是,上面列出的每种方法的各种优点和缺陷是什么,还有其他/更好的方法吗?

c# autofixture

7
推荐指数
1
解决办法
1042
查看次数

使用AutoFixture和Moq模拟HttpResponse.StatusCode

我使用AutoFixture作为自动模拟容器,并想要模拟一个,HttpResponse以便我可以验证StatusCode已设置特定.但是,NotImplementedException我打电话给我SetupSet:

var response = _fixture.Freeze<Mock<HttpResponseBase>>();
response
    .SetupSet(x => x.StatusCode = It.IsAny<int>());
Run Code Online (Sandbox Code Playgroud)

如果我只使用一个新的Mock HttpResponseBase,我也不会例外,但是我必须编写一个FreezeMoq扩展方法,如Mark Seemann的Freezing mocks博客文章中所述.

什么是AutoFixture,这意味着我无法在基类抛出的虚拟属性上设置一个集合NotImplementedException,但是只能使用Moq?

c# unit-testing autofixture

3
推荐指数
1
解决办法
488
查看次数

标签 统计

autofixture ×2

c# ×2

git ×1

unit-testing ×1