public void GetInstanceReusesDisposedInstances()
        {
            var silkveilContainer1 = SilkveilContainerPool.GetInstance();

            silkveilContainer1.Dispose();
            var silkveilContainer2 = SilkveilContainerPool.GetInstance();

            Assert.That(silkveilContainer1, Is.SameAs(silkveilContainer2));
        }
        public void GetInstanceReturnsMultipleInstances()
        {
            var silkveilContainer1 = SilkveilContainerPool.GetInstance();
            var silkveilContainer2 = SilkveilContainerPool.GetInstance();

            Assert.That(silkveilContainer1, Is.InstanceOf(typeof(SilkveilContainer)));
            Assert.That(silkveilContainer2, Is.InstanceOf(typeof(SilkveilContainer)));

            Assert.That(silkveilContainer1, Is.Not.SameAs(silkveilContainer2));
        }
        public void InitializeTypeEnforcesCreationOfNewInstances()
        {
            var silkveilContainer1 = SilkveilContainerPool.GetInstance();

            silkveilContainer1.Dispose();

            SilkveilContainerPool.InitializeType();

            var silkveilContainer2 = SilkveilContainerPool.GetInstance();

            Assert.That(silkveilContainer1, Is.Not.SameAs(silkveilContainer2));
        }
예제 #4
0
        /// <summary>
        /// Processes an incoming HTTP request.
        /// </summary>
        /// <param name="context">The HTTP context that contains the request.</param>
        internal void ProcessRequestInternal(HttpContextBase context)
        {
            this._context = context;

            using (var silkveilContainer = SilkveilContainerPool.GetInstance())
            {
                silkveilContainer.ResponsePartAvailable += this.HandleResponsePartAvailable;
                silkveilContainer.StatusCodeAvailable   += this.HandleStatusCodeAvailable;
                silkveilContainer.HeadersAvailable      += HandleHeadersAvailable;

                silkveilContainer.Handle(context.Request.AppRelativeCurrentExecutionFilePath);

                context.Response.End();
            }
        }
 public void ResetSilkveilContainerPool()
 {
     SilkveilContainerPool.InitializeType();
 }
        public void GetInstance()
        {
            var silkveilContainer = SilkveilContainerPool.GetInstance();

            Assert.That(silkveilContainer, Is.InstanceOf(typeof(SilkveilContainer)));
        }