public MockController1(IUipNavigator navigator, IState state) {
            Assert.IsNotNull(navigator);
            Assert.IsNotNull(state);

            Navigator = navigator;
            State = state;
        }
		public NavigateProxy(IUipNavigator inner)
		{
			this.inner = inner;
		}
 public MockController2(IUipNavigator navigator, IState state)
     : base(navigator, state) {
 }
Example #4
0
		/// <summary>
		/// Create proxies to the state object for nested interfaces called 'INavigator'
		/// </summary>
		/// <remarks>
		/// <para>
		/// Iterate through each controller and view class looking for nested interfaces called 'INavigator'.
		/// If a class contains a nested interface called 'INavigator', assume that this is
		/// a 'navigator proxy' reference to the real navigator object, and create an entry in the service
		/// container that will return a proxy to the navigator object when a service with the nested
		/// interface is requested.
		/// </para>
		/// </remarks>
		private void AddNestedNavigatorInterfaces(IUipNavigator navigator)
		{
			var types = new HashSet<Type>();

			// Get the distinct controller types, remembering that 
			// a controller or view type may be present in more than one node.
			foreach (UipNode node in Nodes)
			{
				Type controllerType = node.ControllerType;
				if (controllerType != null)
				{
					types.Add(controllerType);
				}

				Type viewType = node.ViewType;
				if (viewType != null)
				{
					types.Add(viewType);
				}
			}

			// Look for nested interface types called "INavigator" and assume that they are 
			// duck typing references to the state object.
			foreach (Type type in types)
			{
				Type nestedType = TypeUtil.FindNestedInterface(type, "INavigator");
				if (nestedType != null && nestedType.IsInterface)
				{
					// create a proxy for the navigator object and add it to the service provider
					object navigatorProxy = ProxyFactory.CreateNavigatorProxy(nestedType, navigator);
					_serviceContainer.RegisterInstance(nestedType, navigatorProxy);
				}
			}
		}