Пример #1
0
        /// <summary>
        /// Allows the unit-test to assert the state of the builder that was used
        /// to construct the ICompositeApp.
        /// </summary>
        /// <param name="assert">Delegate passed an instance of the composite-application
        /// to be asserted.</param>
        /// <returns>Self Reference.</returns>
        public ContainerAssert CompositeAppBuilder(Action <ICompositeAppBuilder> assert)
        {
            if (assert == null)
            {
                throw new ArgumentNullException(nameof(assert),
                                                "Assert method not specified.");
            }

            _fixture.AssureContainerComposed();

            assert(_fixture.ContainerUnderTest.AppBuilder);
            return(this);
        }
Пример #2
0
        /// <summary>
        /// Bootstraps the composite-container and adds the resulting IContainerApp
        /// service-collection.
        /// </summary>
        /// <returns>Self Reference.</returns>
        public ContainerAct ComposeContainer()
        {
            if (_actedOn)
            {
                throw new InvalidOperationException("The container can only be acted on once.");
            }

            _actedOn = true;
            try
            {
                _fixture.AssureContainerComposed();
            }
            catch (Exception ex)
            {
                _resultingException = ex;
            }

            return(this);
        }