public void if_no_return_path_is_specified_look_for_special_element() { var method = factory.CreateFrom(typeof(MethodHost).GetMethod("Method")); var returnValue = new object(); var defaults = Mock <IElementConvention>(); conventionManager.Expect(x => x.GetElementConvention(typeof(TextBox))) .Return(defaults); defaults.Expect(x => x.SetValue(host.MethodResult, returnValue)); var result = binder.CreateResult( new MessageProcessingOutcome( returnValue, method.Info.ReturnType, false ) ); result.Execute( new ResultExecutionContext( Stub <IServiceLocator>(), new FakeMessage(sourceNode, method, string.Empty), handlingNode ) ); }
public void should_resolve_special_parameter_value() { const string param1 = "$value"; var source = new TextBox { Text = "the value" }; var convention = Mock <IElementConvention>(); conventionManager.Expect(x => x.GetElementConvention(typeof(TextBox))) .Return(convention); convention.Expect(x => x.GetValue(source)).Return(source.Text); var message = new FakeMessage { Parameters = new FreezableCollection <Parameter> { new Parameter { Value = param1 }, } }; sourceNode.Stub(x => x.UIElement).Return(source); message.Initialize(sourceNode); var requirements = new List <RequiredParameter> { new RequiredParameter("param1", typeof(object)) }; var result = binder.DetermineParameters( message, requirements, handlingNode, null ); result.Length.ShouldBe(1); result.Contains(source.Text).ShouldBeTrue(); }