public static void ThrowArgumentNullExceptionStringTest(
     [Values(null, "", "param")] string paramName
     )
 {
     Assert.That(() => ExceptionUtilities.ThrowArgumentNullException(paramName),
                 Throws.InstanceOf <ArgumentNullException>()
                 .With.Property("ParamName").EqualTo(paramName)
                 );
 }
예제 #2
0
            /// <summary>Initializes a new instance of the <see cref="DebugView" /> class.</summary>
            /// <param name="propertySet">The <see cref="IPropertySet" /> which the instance represents.</param>
            /// <exception cref="ArgumentNullException"><paramref name="propertySet" /> is <c>null</c>.</exception>
            public DebugView(IPropertySet propertySet)
            {
                if (propertySet is null)
                {
                    ExceptionUtilities.ThrowArgumentNullException(nameof(propertySet));
                }

                _propertySet = propertySet;
            }
예제 #3
0
        /// <summary>Initializes a new instance of the <see cref="PropertySet" /> class.</summary>
        /// <param name="items">The <see cref="IDictionary{TKey, TValue}" /> that is wrapped by the instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="items" /> is <c>null</c>.</exception>
        public PropertySet(IDictionary <string, object> items)
        {
            if (items is null)
            {
                ExceptionUtilities.ThrowArgumentNullException(nameof(items));
            }

            _items = items;
        }
예제 #4
0
        /// <summary>Gets the <see cref="IDispatcher" /> instance associated with a <see cref="Thread" />.</summary>
        /// <param name="thread">The <see cref="Thread" /> for which the <see cref="IDispatcher" /> instance should be retrieved.</param>
        /// <returns>The <see cref="IDispatcher" /> instance associated with <paramref name="thread" /> or <c>null</c> if an instance does not exist.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="thread" /> is <c>null</c>.</exception>
        public IDispatcher GetDispatcherForThread(Thread thread)
        {
            if (thread is null)
            {
                ExceptionUtilities.ThrowArgumentNullException(nameof(thread));
            }

            _dispatchers.TryGetValue(thread, out var dispatcher);
            return(dispatcher);
        }
예제 #5
0
        /// <summary>Initializes a new instance of the <see cref="Application" /> class.</summary>
        /// <param name="compositionAssemblies">The set of <see cref="Assembly" /> instances to search for type exports.</param>
        /// <exception cref="ArgumentNullException"><paramref name="compositionAssemblies" /> is <c>null</c>.</exception>
        public Application(IEnumerable <Assembly> compositionAssemblies)
        {
            if (compositionAssemblies is null)
            {
                ExceptionUtilities.ThrowArgumentNullException(nameof(compositionAssemblies));
            }

            var containerConfiguration = new ContainerConfiguration();

            {
                containerConfiguration = containerConfiguration.WithAssemblies(compositionAssemblies);
            }
            _compositionHost = containerConfiguration.CreateContainer();

            _dispatchManager = new Lazy <IDispatchManager>(_compositionHost.GetExport <IDispatchManager>, isThreadSafe: true);
            _windowManager   = new Lazy <IWindowManager>(_compositionHost.GetExport <IWindowManager>, isThreadSafe: true);
        }