本文整理汇总了C#中StructureMap.Pipeline.ConfiguredInstance.Build方法的典型用法代码示例。如果您正苦于以下问题:C# ConfiguredInstance.Build方法的具体用法?C# ConfiguredInstance.Build怎么用?C# ConfiguredInstance.Build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructureMap.Pipeline.ConfiguredInstance
的用法示例。
在下文中一共展示了ConfiguredInstance.Build方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: can_build_a_simple_class_type
public void can_build_a_simple_class_type()
{
var instance = new ConfiguredInstance(typeof (Rule1));
var rule = instance.Build<Rule>(_session);
rule.ShouldNotBeNull();
rule.ShouldBeOfType<Rule1>();
}
示例2: BuildRule1
public void BuildRule1()
{
var instance = new ConfiguredInstance(typeof (Rule1));
var rule = (Rule) instance.Build(typeof (Rule), _session);
Assert.IsNotNull(rule);
Assert.IsTrue(rule is Rule1);
}
示例3: build_fails_with_StructureMapException_adds_context
public void build_fails_with_StructureMapException_adds_context()
{
var instance = new ConfiguredInstance(typeof(ClassThatBlowsUp));
var actual =
Exception<StructureMapBuildException>.ShouldBeThrownBy(() => { instance.Build<ClassThatBlowsUp>(); });
actual.Message.ShouldContain(instance.Description);
actual.ShouldBeOfType<StructureMapBuildException>();
}
示例4: Trying_to_build_with_an_unknown_exception_will_throw_error_207
public void Trying_to_build_with_an_unknown_exception_will_throw_error_207()
{
var mocks = new MockRepository();
var builder = mocks.StrictMock<IInstanceBuilder>();
Expect.Call(builder.BuildInstance(null)).Throw(new Exception());
LastCall.IgnoreArguments();
mocks.Replay(builder);
assertActionThrowsErrorCode(207, delegate
{
var instance = new ConfiguredInstance(GetType());
instance.Build(GetType(), new StubBuildSession(), builder);
});
}