Exemplo n.º 1
0
 public void to_object_def_throws_when_has_task_with_no_result_and_no_input()
 {
     action = ActionCall.For <ControllerTarget>(x => x.ZeroInTaskNoResultOut());
     Exception <FubuException> .ShouldBeThrownBy(
         () => action.As <IContainerModel>().ToObjectDef())
     .ErrorCode.ShouldEqual(1005);
 }
        public void should_log_when_default_route_found()
        {
            var call = new ActionCall(typeof (TestController), _method);
            _policy.Matches(call);

            call.As<ITracedModel>().StagedEvents.OfType<Traced>().Any().ShouldBeTrue();
        }
Exemplo n.º 3
0
 public void to_object_def_throws_when_has_no_return_and_no_input()
 {
     action = ActionCall.For <ControllerTarget>(x => x.ZeroInZeroOut());
     Exception <FubuException> .ShouldBeThrownBy(
         () => action.As <IContainerModel>().ToInstance())
     .ErrorCode.ShouldBe(1005);
 }
Exemplo n.º 4
0
        public void next_is_a_null_by_default()
        {
            action.Next.ShouldBeNull();

            ObjectDef objectDef = action.As <IContainerModel>().ToObjectDef(DiagnosticLevel.None);

            objectDef.Dependencies.Select(x => x as ConfiguredDependency).Count().ShouldEqual(1);
        }
Exemplo n.º 5
0
        public void should_log_when_default_route_found()
        {
            var call = new ActionCall(typeof(TestController), _method);

            _policy.Matches(call);

            call.As <ITracedModel>().StagedEvents.OfType <Traced>().Any().ShouldBeTrue();
        }
Exemplo n.º 6
0
        public void create_the_log_files_for_default_only_matching()
        {
            var filter1 = filterMatching(1, 2, 3);
            var filter2 = filterMatching(1, 2);
            var filter3 = filterMatching(2);

            afterAttaching();

            // going to create one log per profile
            var log = theAction.As <ITracedModel>().StagedEvents.OfType <ViewAttachmentLog>().Single();

            log.Profile.ConditionType.ShouldEqual(typeof(Always));
            log.Profile.ShouldBeOfType <DefaultProfile>();

            log.Logs.ElementAt(0).Filter.ShouldBeTheSameAs(filter1);
            log.Logs.ElementAt(0).Views.ShouldHaveTheSameElementsAs(views(1, 2, 3));

            log.Logs.ElementAt(1).Filter.ShouldBeTheSameAs(filter2);
            log.Logs.ElementAt(1).Views.ShouldHaveTheSameElementsAs(views(1, 2));

            log.Logs.ElementAt(2).Filter.ShouldBeTheSameAs(filter3);
            log.Logs.ElementAt(2).Views.ShouldHaveTheSameElementsAs(views(2));
        }
Exemplo n.º 7
0
        public void SetUp()
        {
            definition = new ActionCall(typeof(ControllerTarget), method);

            theObjectDef = definition.As <IContainerModel>().ToObjectDef(DiagnosticLevel.None);
        }