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>();
 }
        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);
        }
        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>();
        }
        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);
            });
        }