protected override void beforeEach() { theRequest = new TwitterLoginRequest { Url = "hello/there" }; MockFor <IFubuRequest>().Stub(x => x.Get <TwitterLoginRequest>()).Return(theRequest); theLoginBehavior = MockFor <IActionBehavior>(); var chain = new BehaviorChain(); chain.AddToEnd(ActionCall.For <LoginController>(x => x.get_login(null))); var graph = new BehaviorGraph(); graph.AddChain(chain); Services.Inject(graph); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(chain)).Return(theLoginBehavior); ClassUnderTest.Failure(); theLoginRequest = (LoginRequest)MockFor <IFubuRequest>().GetArgumentsForCallsMadeOn(x => x.Set(Arg <LoginRequest> .Is.NotNull))[0][0]; }
public RequestOutputCacheBehavior(IFubuRequest request, IRequestOutputCache <TInputModel> cache, IOutputWriter writer, IActionBehavior inner) { _request = request; _writer = writer; _inner = inner; _cache = cache; }
public DiagnosticBehavior(IDebugReport report, IDebugDetector detector, IActionBehavior inner, IUrlRegistry urls) { _report = report; _detector = detector; _inner = inner; _urls = urls; }
protected override sealed void beforeEach() { theInsideBehavior = MockRepository.GenerateMock <IActionBehavior>(); ClassUnderTest.InsideBehavior = theInsideBehavior; theContextIs(); }
protected override void beforeEach() { MockFor <PartialBehaviorProvider>().Expect(x => x()).Return(PartialBehavior.Executes); InnerBehavior = MockFor <IActionBehavior>(); ClassUnderTest.InsideBehavior = InnerBehavior; }
public void SetUp() { path = new ViewPath { ViewName = "something" }; var render = new WebFormView(path.ViewName); var container = new Container(x => { x.For<IActionBehavior>().Use(new ObjectDefInstance(render.As<IContainerModel>().ToObjectDef(DiagnosticLevel.None))); x.For<IWebFormsControlBuilder>().Use<WebFormsControlBuilder>(); x.For<IWebFormRenderer>().Use<WebFormRenderer>(); x.For<HttpContextBase>().Use(() => new FakeHttpContext()); x.For<IOutputWriter>().Use<OutputWriter>(); x.For<IFubuRequest>().Use<InMemoryFubuRequest>(); x.For<IPageActivator>().Use<PageActivator>(); x.For<IPageActivationRules>().Use<PageActivationRuleCache>(); x.For<IServiceLocator>().Use<StructureMapServiceLocator>(); x.For<IHttpWriter>().Use(new NulloHttpWriter()); x.For<IFileSystem>().Use<FileSystem>(); }); behavior = container.GetInstance<IActionBehavior>(); }
public ConnegBehavior(IFubuRequest request, IActionBehavior inner, IConnegInputHandler inputHandler, IConnegOutputHandler outputHandler) { _request = request; _inner = inner; _inputHandler = inputHandler; _outputHandler = outputHandler; }
protected override void beforeEach() { exception = new NotImplementedException(); inner = MockFor <IActionBehavior>(); inner.Expect(x => x.Invoke()).Throw(exception); MockFor <IDebugDetector>().Stub(x => x.IsDebugCall()).Return(false); }
public ChromeBehavior(IPartialInvoker partials, IActionBehavior inner, IOutputWriter writer, Action <ChromeContent> customization) { _partials = partials; _inner = inner; _writer = writer; _customization = customization; }
protected override void beforeEach() { Services.Inject <IExceptionHandlingObserver>(new ExceptionHandlingObserver()); theInnerBehavior = MockFor <IActionBehavior>(); ClassUnderTest.Inner = theInnerBehavior; }
protected override void beforeEach() { inner = MockFor <IActionBehavior>(); ClassUnderTest.Inner = inner; ClassUnderTest.InvokePartial(); }
public void TransferToCall(ActionCall call, string categoryOrHttpMethod = null) { var chain = _resolver.Find(call.HandlerType, call.Method, categoryOrHttpMethod); IActionBehavior partial = _factory.BuildBehavior(chain); partial.InvokePartial(); }
protected override void beforeEach() { inner = MockFor <IActionBehavior>(); MockFor <IDebugReport>().Stub(x => x.StartBehavior(inner)).Return(new BehaviorReport(inner)); ClassUnderTest.Inner = inner; ClassUnderTest.InvokePartial(); }
public FullChainSwitcher(IActionBehavior inner, ICurrentChain chainStack, BehaviorChain targetChain) { Inner = inner; _chainStack = chainStack; _targetChain = targetChain; }
public void SetUp() { theCorrelator = MockRepository.GenerateStub <ICorrelateRequests>(); theNextBehavior = MockRepository.GenerateStub <IActionBehavior>(); theBehavior = new SetCorrelationHeaders(theCorrelator, theNextBehavior); theBehavior.Invoke(); }
public EnsureFeatureIsEnabled(IFubuRequest fubuRequest, IActionBehavior innerBehavior, ICurrentHttpRequest currentHttpRequest, IHandle404 handle404, IFeatureValidator featureValidator) { _fubuRequest = fubuRequest; _innerBehavior = innerBehavior; _currentHttpRequest = currentHttpRequest; _handle404 = handle404; _featureValidator = featureValidator; }
protected override void beforeEach() { theCurrentRequest = new CurrentRequest(); MockFor <IFubuRequest>().Stub(x => x.Get <CurrentRequest>()).Return(theCurrentRequest); theInnerBehavior = MockFor <IActionBehavior>(); ClassUnderTest.Inner = theInnerBehavior; }
public void SetUp() { theCorrelator = MockRepository.GenerateStub<ICorrelateRequests>(); theNextBehavior = MockRepository.GenerateStub<IActionBehavior>(); theBehavior = new SetCorrelationHeaders(theCorrelator, theNextBehavior); theBehavior.Invoke(); }
public AuthorizationBehavior( IOutputWriter writer, IActionBehavior actionBehavior, ISecureSession<Token> secureSession) { _writer = writer; _actionBehavior = actionBehavior; _secureSession = secureSession; }
public ExceptionHandlerBehavior( IActionBehavior innerBehavior, ILogger logger, IOutputWriter outputWriter) { _innerBehavior = innerBehavior; _logger = logger; _outputWriter = outputWriter; }
protected override void beforeEach() { theTarget = BehaviorChain.For <ControllerTarget>(x => x.ZeroInOneOut()); theChain = MockFor <ICurrentChain>(); theInner = MockFor <IActionBehavior>(); Container.Inject(theTarget); ClassUnderTest.InvokePartial(); }
protected override void beforeEach() { PartialBehaviorProvider provider = () => PartialBehavior.Ignored; Container.Configure(x => x.For(typeof(PartialBehaviorProvider)).Use(provider)); InnerBehavior = MockFor <IActionBehavior>(); ClassUnderTest.InsideBehavior = InnerBehavior; }
protected override void Invoke(IActionBehavior behavior) { var task = Task.Factory.StartNew(behavior.Invoke, TaskCreationOptions.AttachedToParent); var disposable = behavior as IDisposable; if (disposable != null) { task.ContinueWith(x => disposable.Dispose(), TaskContinuationOptions.AttachedToParent); } }
public ExceptionHandlerBehavior(IActionBehavior behavior, HandlerChain chain, Envelope envelope, IInvocationContext context, ILogger logger, IFubuRequest request) { _behavior = behavior; _chain = chain; _envelope = envelope; _context = context; _logger = logger; _request = request; }
public override void LoadFrom(YamlMappingNode mapping) { base.LoadFrom(mapping); var serializer = YamlObjectSerializer.NewReader(mapping); serializer.DataField(this, x => x.ActionType, "actionType", ActionType.Error); if (ActionType == ActionType.Error) { Logger.ErrorS("action", "missing or invalid actionType for action with name {0}", Name); } // TODO: Split this class into server/client after RobustToolbox#1405 if (IoCManager.Resolve <IModuleManager>().IsClientModule) { return; } IActionBehavior behavior = null; serializer.DataField(ref behavior, "behavior", null); switch (behavior) { case null: BehaviorType = BehaviorType.None; Logger.ErrorS("action", "missing or invalid behavior for action with name {0}", Name); break; case IInstantAction instantAction: ValidateBehaviorType(BehaviorType.Instant, typeof(IInstantAction)); BehaviorType = BehaviorType.Instant; InstantAction = instantAction; break; case IToggleAction toggleAction: ValidateBehaviorType(BehaviorType.Toggle, typeof(IToggleAction)); BehaviorType = BehaviorType.Toggle; ToggleAction = toggleAction; break; case ITargetEntityAction targetEntity: ValidateBehaviorType(BehaviorType.TargetEntity, typeof(ITargetEntityAction)); BehaviorType = BehaviorType.TargetEntity; TargetEntityAction = targetEntity; break; case ITargetPointAction targetPointAction: ValidateBehaviorType(BehaviorType.TargetPoint, typeof(ITargetPointAction)); BehaviorType = BehaviorType.TargetPoint; TargetPointAction = targetPointAction; break; default: BehaviorType = BehaviorType.None; Logger.ErrorS("action", "unrecognized behavior type for action with name {0}", Name); break; } }
protected override void theContextIs() { call = ActionCall.For <ControllerTarget>(x => x.ZeroInOneOut()); partial = MockRepository.GenerateMock <IActionBehavior>(); MockFor <IPartialFactory>().Expect(x => x.BuildPartial(call)).Return(partial); ProcessContinuation(FubuContinuation.TransferTo <ControllerTarget>(x => x.ZeroInOneOut())); }
protected override void theContextIs() { partial = MockRepository.GenerateMock <IActionBehavior>(); input = new InputModel(); MockFor <IPartialFactory>().Expect(x => x.BuildPartial(typeof(InputModel))).Return(partial); ProcessContinuation(FubuContinuation.TransferTo(input)); }
public IHttpHandler GetHttpHandler(RequestContext requestContext) { var dictionary = new AggregateDictionary(requestContext); ServiceArguments arguments = new ServiceArguments().With(dictionary); IActionBehavior behavior = GetBehavior(arguments); return(new FubuHttpHandler(behavior)); }
protected override void beforeEach() { exception = new NotImplementedException(); inner = MockFor <IActionBehavior>(); inner.Expect(x => x.Invoke()).Throw(exception); MockFor <IDebugDetector>().Stub(x => x.IsOutputWritingLatched()).Return(false); MockFor <IDebugReport>().Stub(x => x.StartBehavior(inner)).Return(new BehaviorReport(inner)); ClassUnderTest.Inner = inner; }
public OutputCachingBehavior(IActionBehavior inner, IContentCache cache, IOutputWriter writer, IResourceHash resourceHash) { _inner = inner; _cache = cache; _writer = writer; _resourceHash = resourceHash; Invoker = x => x.Invoke(); PartialInvoker = x => x.InvokePartial(); }
public override void Given() { AspNetSettings.IsCustomErrorsEnabled = false; _exception = new Exception("bad things happened"); _insideBehavior = MockFor <IActionBehavior>(); _cut.InsideBehavior = _insideBehavior; _insideBehavior.Stub(s => s.Invoke()).Throw(_exception); }
protected override void beforeEach() { exception = new NotImplementedException(); inner = MockFor <IActionBehavior>(); inner.Expect(x => x.InvokePartial()).Throw(exception); MockFor <IDebugDetector>().Stub(x => x.IsDebugCall()).Return(true); ClassUnderTest.Inner = inner; ClassUnderTest.InvokePartial(); }
public AjaxAuthorizationBehavior( IOutputWriter writer, IActionBehavior actionBehavior, ISecureSession<Token> secureSession, IWebServer webServer) { _writer = writer; _actionBehavior = actionBehavior; _secureSession = secureSession; _webServer = webServer; }
protected override void beforeEach() { theInput = new PartialInputModel(); theAction = MockFor <IActionBehavior>(); MockFor <IFubuRequest>().Stub(x => x.Get <PartialInputModel>()).Return(theInput); MockFor <IAuthorizationPreviewService>().Expect(x => x.IsAuthorized(theInput)).Return(false); MockFor <IPartialFactory>().Stub(x => x.BuildPartial(typeof(PartialInputModel))).Return(theAction); theOutput = ClassUnderTest.InvokeObject(theInput); }
protected override void beforeEach() { logs = Services.RecordLogging(); correlation = new BehaviorCorrelation(new FakeNode()); Services.Inject(correlation); inner = MockFor <IActionBehavior>(); ClassUnderTest.Inner = inner; ClassUnderTest.InvokePartial(); }
public BehaviorReport StartBehavior(IActionBehavior behavior) { var report = new BehaviorReport(behavior); _behaviors.Add(report); _behaviorStack.Push(report); AddDetails(new BehaviorStart()); return(report); }
public OutputCachingBehavior(IActionBehavior inner, IOutputCache cache, IOutputWriter writer, ICurrentChain currentChain, IEtagCache etagCache) { _inner = inner; _cache = cache; _writer = writer; _currentChain = currentChain; _etagCache = etagCache; Invoker = x => x.Invoke(); PartialInvoker = x => x.InvokePartial(); }
public AjaxExceptionHandlerBehavior( IActionBehavior innerBehavior, IOutputWriter outputWriter, ILogger logger, IWebServer webServer) { _innerBehavior = innerBehavior; _outputWriter = outputWriter; _logger = logger; _webServer = webServer; ReturnError = Assembly.GetExecutingAssembly().IsInDebugMode(); }
public LoginResultBehavior( IFubuRequest request, IUrlRegistry registry, IOutputWriter writer, IActionBehavior innerBehavior, IPartialFactory factory ) { this.request = request; this.registry = registry; this.writer = writer; this.innerBehavior = innerBehavior; this.factory = factory; }
public void SetUp() { theFactory = MockRepository.GenerateMock<IServiceFactory>(); theChain = new RoutedChain("something"); theRouteData = new Dictionary<string, object>(); theArguments = new TypeArguments(); theBehavior = MockRepository.GenerateMock<IActionBehavior>(); theFactory.Stub(x => x.BuildBehavior(theArguments, theChain.UniqueId)) .Return(theBehavior); theInvoker = new BehaviorInvoker(theFactory, theChain); }
protected virtual void Invoke(IActionBehavior behavior) { try { behavior.Invoke(); } finally { var disposable = behavior as IDisposable; if(disposable != null) { disposable.Dispose(); } } }
public void SetUp() { request = MockRepository.GenerateStub<IFubuRequest>(); inner = MockRepository.GenerateStub<IActionBehavior>(); viewModel = new RemapViewModel(); behaviour = new RemapFailedValidationFormValuesBehaviour<RemapInputModel>(request) {InnerBehavior = inner}; request.Stub(r => r.Get(typeof(RemapViewModel))).Return(viewModel); request.Stub(r => r.Get<RemapViewModel>()).Return(viewModel); inputModel = new RemapInputModel { Name = "Jimmy Bogard", Age = 150, Height = 125 }; }
public void SetUp() { path = new ViewPath { ViewName = "something" }; var render = new WebFormView(path.ViewName); var container = new Container(x => { x.For<IActionBehavior>().Use(new ObjectDefInstance(render.As<IContainerModel>().ToObjectDef())); x.For<IWebFormsControlBuilder>().Use<WebFormsControlBuilder>(); x.For<IWebFormRenderer>().Use<WebFormRenderer>(); x.For<IOutputWriter>().Use<HttpResponseOutputWriter>(); x.For<IFubuRequest>().Use<InMemoryFubuRequest>(); x.For<IViewActivator>().Use<NulloViewActivator>(); }); behavior = container.GetInstance<IActionBehavior>(); }
public SSLRedirectBehavior(IActionBehavior innerBehavior, IOutputWriter outputWriter, ICurrentHttpRequest request) { _innerBehavior = innerBehavior; _outputWriter = outputWriter; _request = request; }
public PartialLoggingBehavior(IChainExecutionLog log, BehaviorChain chain, IActionBehavior inner) { _log = log; _chain = chain; Inner = inner; }
public SetCorrelationHeaders(ICorrelateRequests correlator, IActionBehavior inner) : base(PartialBehavior.Ignored) { _correlator = correlator; InsideBehavior = inner; }
public FakeUnitOfWorkBehavior(IActionBehavior inner) { _inner = inner; }
public ChromeBehavior(IPartialInvoker partials, IActionBehavior inner, IOutputWriter writer) { _partials = partials; _inner = inner; _writer = writer; }
public CacheBusterBehavior(IActionBehavior innerBehavior) { _innerBehavior = innerBehavior; }
public FubuHttpHandler(IActionBehavior behavior) { _behavior = behavior; }
public void SetUp() { _page = MockRepository.GenerateStub<IFubuPage>(); _partialFactory = MockRepository.GenerateStub<IPartialFactory>(); _behavior = MockRepository.GenerateStub<IActionBehavior>(); _partialFactory.Stub(f => f.BuildPartial(typeof (InputModel))).Return(_behavior); _page.Stub(p => p.Get<IPartialFactory>()).Return(_partialFactory); _request = MockRepository.GenerateStub<IFubuRequest>(); _page.Stub(p => p.Get<IFubuRequest>()).Return(_request); }
public MyTransactionBehavior(IActionBehavior inner) { _inner = inner; }
public ConditionalOutput(Func<OutputFormatDetector, bool> condition, IActionBehavior behavior) { Condition = condition; Behavior = behavior; }
public DemoBehaviorForSelectActions(IActionBehavior innerBehavior) { _innerBehavior = innerBehavior; }
public TransactionScopeBehavior(IActionBehavior innerBehavior, IUnitOfWork unitOfWork) { _innerBehavior = innerBehavior; _unitOfWork = unitOfWork; }
public BehaviorTracer(IDebugReport report, IDebugDetector debugDetector, IActionBehavior inner) { _report = report; _debugDetector = debugDetector; _inner = inner; }