Exemplo n.º 1
0
        public void Initialize()
        {
            if (Settings.Instance == null)
            {
                Settings.Initialize(b => { b.Scheme = "tst"; });
            }

            this._uriResolvedObjectHolder    = Substitute.For <IUriResolvedObjectHolder>();
            this._uriResolutionCustomization = Substitute.For <IUriResolutionCustomization>();
            this._uriModuleItemResolver      = Substitute.For <IUriModuleItemResolver>();
            this._resolveSetupFactory        = Substitute.For <IResolveSetupFactory>();
            this._traceListener      = Substitute.For <TraceListener>();
            this._uriDisconnectTable = Substitute.For <IUriDisconnectTable>();

            IUriModuleItemResolver uriModuleResolverStub;
            var uriModuleResolverIndex = Substitute.For <IIndex <UriModuleItemResolverKey, IUriModuleItemResolver> >();

            uriModuleResolverIndex
            .TryGetValue(new UriModuleItemResolverKey("module", "item"), out uriModuleResolverStub)
            .Returns(
                x =>
            {
                x[1] = this._uriModuleItemResolver;
                return(true);
            });

            var anyPlacementResolver = Substitute.For <IUriPlacementResolver>();

            anyPlacementResolver.Resolve(null, null, null).ReturnsForAnyArgs(Substitute.For <IUriPlacementConnector>());

            this._uriResolutionCustomization.ModuleItemResolvers.Returns(uriModuleResolverIndex);
            this._uriResolutionCustomization.PlacementResolvers.Returns(Enumerable.Repeat(anyPlacementResolver, 1));

            Trace.Listeners.Add(this._traceListener);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the class <see cref="ResolveOpen"/>.
        /// </summary>
        /// <param name="uri">URI to be resolved.</param>
        /// <param name="attachments">The list of attached to an URI objects with identifiers..</param>
        /// <param name="resolveSetupFactory">The factory of a service for setup of objects resolved via an URI.</param>
        /// <param name="uriResolvedObjectHolder">The holder of objects resolved via an URI.</param>
        /// <param name="uriDisconnectTable">The table for disconnecting objects from an user interface.</param>
        /// <param name="uriResolutionCustomization">The object that provides custom components of the URI resolution process.</param>
        public ResolveOpen(
            Uri uri,
            object[] attachments,
            IResolveSetupFactory resolveSetupFactory,
            IUriResolvedObjectHolder uriResolvedObjectHolder,
            IUriDisconnectTable uriDisconnectTable,
            IUriResolutionCustomization uriResolutionCustomization)
        {
            Contract.Requires <ArgumentNullException>(uri != null);
            Contract.Requires <ArgumentNullException>(attachments != null);
            Contract.Requires <ArgumentNullException>(resolveSetupFactory != null);
            Contract.Requires <ArgumentNullException>(uriResolvedObjectHolder != null);
            Contract.Requires <ArgumentNullException>(uriDisconnectTable != null);
            Contract.Requires <ArgumentNullException>(uriResolutionCustomization != null);

            this._unresolvedUri              = uri;
            this._attachments                = attachments;
            this._resolveSetupFactory        = resolveSetupFactory;
            this._uriResolvedObjectHolder    = uriResolvedObjectHolder;
            this._uriResolutionCustomization = uriResolutionCustomization;
            this._uriDisconnectTable         = uriDisconnectTable;
        }