本文整理汇总了C#中Builder.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# Builder.Commit方法的具体用法?C# Builder.Commit怎么用?C# Builder.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Builder
的用法示例。
在下文中一共展示了Builder.Commit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Commit_RunStepsInTheOrderTheDependencySorterDictates
public void Commit_RunStepsInTheOrderTheDependencySorterDictates()
{
var results = new Queue<Tuple<Type, string>>();
Action<Type, string> capture = (t, s) =>
results.Enqueue(new Tuple<Type, string>(t, s));
var buildSteps = new IBuildStep[]
{
new Step1(capture),
new Step2(capture),
};
var dependencySorter = Substitute.For<IBuildStepDependencySorter>();
dependencySorter.Sort(Arg.Any<IEnumerable<IBuildStep>>())
.Returns(buildSteps.Reverse());
var sut = new Builder(dependencySorter)
.With(buildSteps[0])
.With(buildSteps[1]);
sut.Commit();
var firstStep = results.Dequeue();
firstStep.Item1.Should().Be(typeof (Step2));
firstStep.Item2.Should().Be("Commit");
var secondStep = results.Dequeue();
secondStep.Item1.Should().Be(typeof (Step1));
secondStep.Item2.Should().Be("Commit");
results.Count.Should().Be(0);
}
示例2: Commit_CallsCommitOnEachBuildStepOnce
public void Commit_CallsCommitOnEachBuildStepOnce()
{
// Arrange
var buildSteps = new[]
{
Substitute.For<IBuildStep>(),
Substitute.For<IBuildStep>(),
Substitute.For<IBuildStep>()
};
var dependencySorter = Substitute.For<IBuildStepDependencySorter>();
dependencySorter.Sort(Arg.Any<IEnumerable<IBuildStep>>())
.Returns(buildSteps);
var sut = new Builder(dependencySorter)
.With(buildSteps[1])
.With(buildSteps[2])
.With(buildSteps[0]);
// Act
sut.Commit();
// Assert
buildSteps[0].Received(1).Commit();
buildSteps[1].Received(1).Commit();
buildSteps[2].Received(1).Commit();
}