/// <summary> /// Initializes a new instance of the <see cref="DependencyObserver"/> class. /// </summary> /// <param name="messageHandler">The message handler.</param> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> public DependencyObserver(IRoutedMessageHandler messageHandler, IMethodFactory methodFactory, INotifyPropertyChanged notifier) { _messageHandler = messageHandler; _methodFactory = methodFactory; _notifier = notifier; _singlePathObservers = new Dictionary<string, SinglePropertyPathObserver>(); }
/// <summary> /// Initializes a new instance of the <see cref="DependencyObserver"/> class. /// </summary> /// <param name="messageHandler">The message handler.</param> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> public DependencyObserver(IRoutedMessageHandler messageHandler, IMethodFactory methodFactory, INotifyPropertyChanged notifier) { _messageHandler = messageHandler; _methodFactory = methodFactory; _weakNotifier = new WeakReference<INotifyPropertyChanged>(notifier); _monitoringInfos = new Dictionary<string, MonitoringInfo>(); }
protected override void given_the_context_of() { theInvokeTarget = new MethodInvokeTarget(); MethodInvokeTarget.Reset(); factory = new DefaultMethodFactory(); }
/// <summary> /// Initializes a new instance of the <see cref="DependencyObserver"/> class. /// </summary> /// <param name="messageHandler">The message handler.</param> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> public DependencyObserver(IRoutedMessageHandler messageHandler, IMethodFactory methodFactory, INotifyPropertyChanged notifier) { this.messageHandler = messageHandler; this.methodFactory = methodFactory; this.notifier = notifier; singlePathObservers = new Dictionary <string, SinglePropertyPathObserver>(); }
/// <summary> /// Initializes a new instance of the <see cref="DependencyObserver"/> class. /// </summary> /// <param name="messageHandler">The message handler.</param> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> public DependencyObserver(IRoutedMessageHandler messageHandler, IMethodFactory methodFactory, INotifyPropertyChanged notifier) { _messageHandler = messageHandler; _methodFactory = methodFactory; _weakNotifier = new WeakReference <INotifyPropertyChanged>(notifier); _monitoringInfos = new Dictionary <string, MonitoringInfo>(); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultActionLocator"/> class. /// </summary> /// <param name="serviceLocator">The service locator.</param> /// <param name="methodFactory">The method factory.</param> /// <param name="messageBinder">The message binder.</param> /// <param name="conventionManager">The convention manager.</param> public DefaultActionLocator(IServiceLocator serviceLocator, IMethodFactory methodFactory, IMessageBinder messageBinder, IConventionManager conventionManager) { this.serviceLocator = serviceLocator; this.methodFactory = methodFactory; this.messageBinder = messageBinder; this.conventionManager = conventionManager; }
public MethodOverrideFactory(IRelatedMethodFinder relatedMethodFinder, IMethodFactory methodFactory) { ArgumentUtility.CheckNotNull("relatedMethodFinder", relatedMethodFinder); ArgumentUtility.CheckNotNull("methodFactory", methodFactory); _relatedMethodFinder = relatedMethodFinder; _methodFactory = methodFactory; }
protected override void given_the_context_of() { methodFactory = Mock <IMethodFactory>(); conventionManager = new DefaultConventionManager( methodFactory ); }
protected override void given_the_context_of() { _methodFactory = Mock<IMethodFactory>(); _conventionManager = new DefaultConventionManager( _methodFactory ); }
public void SetUp() { _methodFactoryMock = MockRepository.GenerateStrictMock <IMethodFactory>(); _factory = new EventFactory(_methodFactoryMock); _mutableType = MutableTypeObjectMother.Create(); }
protected override void given_the_context_of() { methodFactory = Mock<IMethodFactory>(); info = typeof(MethodHost).GetMethod("Rescue"); attribute = new RescueAttribute("Rescue"); container = Stub<IServiceLocator>(); container.Stub(x => x.GetInstance<IMethodFactory>()).Return(methodFactory).Repeat.Any(); }
protected override void given_the_context_of() { methodFactory = Mock <IMethodFactory>(); info = typeof(MethodHost).GetMethod("Rescue"); attribute = new RescueAttribute("Rescue"); container = Stub <IServiceLocator>(); container.Stub(x => x.GetInstance(typeof(IMethodFactory), null)).Return(methodFactory).Repeat.Any(); }
public GrpcServerBuilder( IMethodHandlerProvider <TRequest, TResponse> methodHandlerProvider, IMethodFactory <TRequest, TResponse> methodFactory ) { _methodHandlerProvider = methodHandlerProvider; _methodFactory = methodFactory; _server = new Server(); }
protected override void given_the_context_of() { methodFactory = Mock <IMethodFactory>(); messageBinder = Mock <IMessageBinder>(); serviceLocator = Mock <IServiceLocator>(); conventionManager = Mock <IConventionManager>(); locator = new DefaultActionLocator(serviceLocator, methodFactory, messageBinder, conventionManager); }
protected override void given_the_context_of() { methodFactory = Mock<IMethodFactory>(); info = typeof(MethodHost).GetMethod("Callback"); attribute = new AsyncActionAttribute { Callback = "Callback" }; container = Stub<IServiceLocator>(); container.Stub(x => x.GetInstance<IMethodFactory>()).Return(methodFactory).Repeat.Any(); }
public void SetUp() { _relatedMethodFinderMock = MockRepository.GenerateStrictMock <IRelatedMethodFinder> (); _methodFactoryMock = MockRepository.GenerateStrictMock <IMethodFactory>(); _factory = new MethodOverrideFactory(_relatedMethodFinderMock, _methodFactoryMock); _mutableType = MutableTypeObjectMother.Create(name: "MyAbcType", baseType: typeof(DomainType)); _noGenericParameters = new GenericParameterContext(Type.EmptyTypes); }
public DataProcessor( IMethodFactory methodFactory, IRepository repository, ISettings settings, ILog logger) { _methodFactory = methodFactory; _repository = repository; _settings = settings; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultConventionManager"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> public DefaultConventionManager(IMethodFactory methodFactory) { this.methodFactory = methodFactory; GetDefaultElementConventions() .Apply(AddElementConvention); SetupDefaultViewConventions(); SetupDefaultConverterConventions(); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyPathMonitor"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> /// <param name="propertyPath">The property path.</param> /// <param name="onPathChanged">The on path changed.</param> public PropertyPathMonitor(IMethodFactory methodFactory, INotifyPropertyChanged notifier, string propertyPath, Action onPathChanged) { _methodFactory = methodFactory; _notifier = new WeakReference<INotifyPropertyChanged>(notifier); _notifyOfChange = onPathChanged; _propertyPath = propertyPath; _observedPropertyName = GetRootProperty(_propertyPath); _subPath = GetSubPath(_propertyPath); notifier.PropertyChanged += Notifier_PropertyChanged; HookSubpathMonitor(); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyPathMonitor"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> /// <param name="propertyPath">The property path.</param> /// <param name="onPathChanged">The on path changed.</param> public PropertyPathMonitor(IMethodFactory methodFactory, INotifyPropertyChanged notifier, string propertyPath, Action onPathChanged) { _methodFactory = methodFactory; _notifier = new WeakReference <INotifyPropertyChanged>(notifier); _notifyOfChange = onPathChanged; _propertyPath = propertyPath; _observedPropertyName = GetRootProperty(_propertyPath); _subPath = GetSubPath(_propertyPath); notifier.PropertyChanged += Notifier_PropertyChanged; HookSubpathMonitor(); }
protected override void given_the_context_of() { methodFactory = Mock<IMethodFactory>(); info = typeof(MethodHost).GetMethod("Preview"); attribute = new PreviewAttribute("Preview"); container = Stub<IServiceLocator>(); container.Stub(x => x.GetInstance<IMethodFactory>()).Return(methodFactory).Repeat.Any(); routedMessageHandler = Mock<IRoutedMessageHandler>(); var metadata = new List<object>(); routedMessageHandler.Stub(x => x.Metadata).Return(metadata).Repeat.Any(); }
/// <summary> /// Initializes a new instance of the <see cref="ActionCreationContext"/> class. /// </summary> /// <param name="serviceLocator">The service locator.</param> /// <param name="methodFactory">The method factory.</param> /// <param name="messageBinder">The message binder.</param> /// <param name="conventionManager">The convention manager</param> /// <param name="targetType">Type of the target.</param> /// <param name="targetFilters">The target filters.</param> /// <param name="method">The method.</param> public ActionCreationContext(IServiceLocator serviceLocator, IMethodFactory methodFactory, IMessageBinder messageBinder, IConventionManager conventionManager, Type targetType, IFilterManager targetFilters, MethodInfo method) { ConventionManager = conventionManager; ServiceLocator = serviceLocator; MethodFactory = methodFactory; MessageBinder = messageBinder; TargetType = targetType; TargetFilters = targetFilters; Method = method; }
/// <summary> /// Initializes a new instance of the <see cref="GenericMethod"/> class. /// </summary> /// <param name="method">The method info.</param> /// <param name="factory"> /// The factory to create an <see cref="IMethod" /> from the <see cref="MethodInfo" /> /// resolved by <see cref="GenericMethod" />. /// </param> public GenericMethod(MethodInfo method, IMethodFactory factory) { if (method == null) throw new ArgumentNullException("method"); if (factory == null) throw new ArgumentNullException("factory"); this.method = method; this.factory = factory; this.parametersInfo = method.GetParameters(); }
protected override void given_the_context_of() { methodFactory = Mock <IMethodFactory>(); info = typeof(MethodHost).GetMethod("Preview"); attribute = new PreviewAttribute("Preview"); container = Stub <IServiceLocator>(); container.Stub(x => x.GetInstance(typeof(IMethodFactory), null)).Return(methodFactory).Repeat.Any(); routedMessageHandler = Mock <IRoutedMessageHandler>(); var metadata = new List <object>(); routedMessageHandler.Stub(x => x.Metadata).Return(metadata).Repeat.Any(); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyPathMonitor"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> /// <param name="propertyPath">The property path.</param> /// <param name="parentMonitor">The parent monitor.</param> public PropertyPathMonitor(IMethodFactory methodFactory, INotifyPropertyChanged notifier, string propertyPath, IChangeMonitorNode parentMonitor) { this.methodFactory = methodFactory; notifierRef = new WeakReference(notifier); parentMonitorRef = new WeakReference(parentMonitor); this.propertyPath = propertyPath; observedPropertyName = GetRootProperty(this.propertyPath); subPath = GetSubPath(this.propertyPath); VerifyObservedPropertyExists(); notifier.PropertyChanged += Notifier_PropertyChanged; HookSubpathMonitor(); }
public SessionFactory( IConnectionTargetProvider connectionTargetProvider, IMethodFactory <TRequest, TResponse> methodFactory, IMetricRepository metricRepository, IChannelProvider channelProvider, IConfigurationProvider configurationProvider, IAlleyLogger logger) { _connectionTargetProvider = connectionTargetProvider; _configurationProvider = configurationProvider; _methodFactory = methodFactory; _metricRepository = metricRepository; _channelProvider = channelProvider; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="GenericMethod"/> class. /// </summary> /// <param name="method">The method info.</param> /// <param name="factory"> /// The factory to create an <see cref="IMethod" /> from the <see cref="MethodInfo" /> /// resolved by <see cref="GenericMethod" />. /// </param> public GenericMethod(MethodInfo method, IMethodFactory factory) { if (method == null) { throw new ArgumentNullException(nameof(method)); } if (factory == null) { throw new ArgumentNullException(nameof(factory)); } this.Method = method; this.Factory = factory; this.parametersInfo = method.GetParameters(); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyPathMonitor"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> /// <param name="notifier">The notifier.</param> /// <param name="propertyPath">The property path.</param> /// <param name="onPathChanged">The on path changed.</param> public PropertyPathMonitor(IMethodFactory methodFactory, INotifyPropertyChanged notifier, string propertyPath, IChangeMonitorNode parentMonitor) { _methodFactory = methodFactory; _notifierRef = new WeakReference(notifier); _parentMonitorRef = new WeakReference(parentMonitor); _propertyPath = propertyPath; _observedPropertyName = GetRootProperty(_propertyPath); _subPath = GetSubPath(_propertyPath); VerifyObservedPropertyExists(); notifier.PropertyChanged += Notifier_PropertyChanged; HookSubpathMonitor(); }
private MutableMethodInfo SetupExpectationsForCreateMethod( IMethodFactory methodFactoryMock, MutableType mutableType, MethodInfo baseMethod, string expectedParameterName, string expectedOverrideMethodName, MethodAttributes expectedOverrideAttributes, bool skipBodyProviderCheck) { var methodParameters = baseMethod.GetParameters().Select(p => new ParameterDeclaration(p.ParameterType, p.Name, p.Attributes)); var fakeResult = MutableMethodInfoObjectMother.Create(mutableType, attributes: MethodAttributes.Virtual, parameters: methodParameters); methodFactoryMock .Expect( mock => mock.CreateMethod( Arg.Is(mutableType), Arg.Is(expectedOverrideMethodName), Arg.Is(expectedOverrideAttributes | MethodAttributes.Virtual | MethodAttributes.HideBySig), Arg.Is(GenericParameterDeclaration.None), Arg <Func <GenericParameterContext, Type> > .Is.Anything, Arg <Func <GenericParameterContext, IEnumerable <ParameterDeclaration> > > .Is.Anything, Arg <Func <MethodBodyCreationContext, Expression> > .Is.Anything)) .WhenCalled( mi => { var returnType = ((Func <GenericParameterContext, Type>)mi.Arguments[4])(_noGenericParameters); var parameters = ((Func <GenericParameterContext, IEnumerable <ParameterDeclaration> >)mi.Arguments[5])(_noGenericParameters); Assert.That(returnType, Is.SameAs(typeof(void))); var parameter = parameters.Single(); Assert.That(parameter.Name, Is.EqualTo(expectedParameterName)); Assert.That(parameter.Type, Is.SameAs(typeof(int))); if (skipBodyProviderCheck) { return; } var body = ((Func <MethodBodyCreationContext, Expression>)mi.Arguments[6])(CreateMethodBodyCreationContext(baseMethod)); Assert.That(body, Is.InstanceOf <MethodCallExpression>()); var methodCallExpression = (MethodCallExpression)body; Assert.That(methodCallExpression.Method, Is.TypeOf <NonVirtualCallMethodInfoAdapter>()); var baceCallMethodInfoAdapter = (NonVirtualCallMethodInfoAdapter)methodCallExpression.Method; Assert.That(baceCallMethodInfoAdapter.AdaptedMethod, Is.SameAs(baseMethod)); }) .Return(fakeResult); return(fakeResult); }
protected MethodTypeConvertorBase(IMethodFactory methodFactory, ILocationFactory locationFactory, IUnderlyingObjectFactory underlyingObjectFactory) { if (methodFactory == null) { throw new ArgumentNullException(nameof(methodFactory)); } if (locationFactory == null) { throw new ArgumentNullException(nameof(locationFactory)); } if (underlyingObjectFactory == null) { throw new ArgumentNullException(nameof(underlyingObjectFactory)); } this.methodFactory = methodFactory; this.locationFactory = locationFactory; this.underlyingObjectFactory = underlyingObjectFactory; }
public AstMethodsVisitor(IMethodFactory methodFactory, ILocationFactory locationFactory, IUnderlyingObjectFactory underlyingObjectFactory) { if (methodFactory == null) { throw new ArgumentNullException(nameof(methodFactory)); } if (locationFactory == null) { throw new ArgumentNullException(nameof(locationFactory)); } if (underlyingObjectFactory == null) { throw new ArgumentNullException(nameof(underlyingObjectFactory)); } this.methodFactory = methodFactory; this.locationFactory = locationFactory; this.underlyingObjectFactory = underlyingObjectFactory; }
/// <summary> /// Initializes the filter. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="metadataContainer">The metadata container.</param> /// <param name="serviceLocator">The serviceLocator.</param> public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator) { _target = metadataContainer; _methodFactory = serviceLocator.GetInstance<IMethodFactory>(); }
public ClassMethodDefinition(SourceReference <string> className, SourceReference <string> selector, ISourceCodeReferenceService sourceCodeService, ISourceCodeReferenceService methodSourceCodeService, IMethodFactory factory) : base(className, selector, sourceCodeService, methodSourceCodeService, factory) { }
/// <summary> /// Initializes the filter. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="memberInfo">The member.</param> /// <param name="serviceLocator">The serviceLocator.</param> public void Initialize(Type targetType, MemberInfo memberInfo, IServiceLocator serviceLocator) { target = memberInfo; methodFactory = serviceLocator.GetInstance<IMethodFactory>(); }
/// <summary> /// Initializes the filter. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="memberInfo">The member.</param> /// <param name="serviceLocator">The serviceLocator.</param> public void Initialize(Type targetType, MemberInfo memberInfo, IServiceLocator serviceLocator) { target = memberInfo; methodFactory = serviceLocator.GetInstance <IMethodFactory>(); }
public SinglePropertyPathObserver(IRoutedMessageHandler messageHandler, IMethodFactory methodFactory, INotifyPropertyChanged notifier, string propertyPath) { _messageHandler = messageHandler; _monitor = new PropertyPathMonitor(methodFactory, notifier, propertyPath, this); }
/// <summary> /// Initializes the filter. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="member">The member.</param> /// <param name="serviceLocator">The serviceLocator.</param> public override void Initialize(Type targetType, MemberInfo member, IServiceLocator serviceLocator) { _target = member; _methodFactory = serviceLocator.GetInstance<IMethodFactory>(); }
public InstanceMethodDefinition(SourceReference <string> className, SourceReference <string> selector, ISourceCodeReferenceService sourceCodeService, ISourceCodeReferenceService methodSourceCodeService, IMethodFactory code) : base(className, selector, sourceCodeService, methodSourceCodeService, code) { }
/// <summary> /// Initializes a new instance of the <see cref="ActionFactory"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> /// <param name="messageBinder">The parameter binder used by actions.</param> public ActionFactory(IMethodFactory methodFactory, IMessageBinder messageBinder) { _methodFactory = methodFactory; _messageBinder = messageBinder; }
public void Initialize(Type targetType, System.Reflection.MemberInfo member, Caliburn.Core.InversionOfControl.IServiceLocator serviceLocator) { this._member = member; _serviceLocator = serviceLocator; _methodFactory = _serviceLocator.GetInstance<IMethodFactory>(); CreateMethod(_isInZoomMethodName, ref _isInZoomMethod, targetType); CreateMethod(_selectedItemsMethodName,ref _selectedItemsMethod, targetType); }
public MonitoringInfo(IRoutedMessageHandler messageHandler, IMethodFactory methodFactory, INotifyPropertyChanged notifier, string propertyPath) { _messageHandler = messageHandler; new PropertyPathMonitor(methodFactory, notifier, propertyPath, OnPathChanged); }
/// <summary> /// Initializes a new instance of the <see cref="ActionFactory"/> class. /// </summary> /// <param name="methodFactory">The method factory.</param> /// <param name="messageBinder">The parameter binder used by actions.</param> public CustomActionFactory(IMethodFactory methodFactory, IMessageBinder messageBinder) : base(methodFactory, messageBinder) { }
/// <summary> /// Initializes the filter. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="metadataContainer">The metadata container.</param> /// <param name="serviceLocator">The serviceLocator.</param> public void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator) { _target = metadataContainer; _methodFactory = serviceLocator.GetInstance <IMethodFactory>(); }
/// <summary> /// Initializes the filter. /// </summary> /// <param name="targetType">Type of the target.</param> /// <param name="metadataContainer">The metadata container.</param> /// <param name="serviceLocator">The serviceLocator.</param> public override void Initialize(Type targetType, IMetadataContainer metadataContainer, IServiceLocator serviceLocator) { base.Initialize(targetType, metadataContainer, serviceLocator); _methodFactory = serviceLocator.GetInstance<IMethodFactory>(); }
public PropertyFactory(IMethodFactory methodFactory) { ArgumentUtility.CheckNotNull("methodFactory", methodFactory); _methodFactory = methodFactory; }