public void ReleaseInstance_HttpInstanceProvider_Null_Instance_Throws()
        {
            EmptyService         instance = new EmptyService();
            InstanceContext      context  = new InstanceContext(instance);
            HttpInstanceProvider provider = new SHttpInstanceProvider();

            ExceptionAssert.ThrowsArgumentNull("instance", () => provider.ReleaseInstance(context, null));
        }
        public void ReleaseInstance_Calls_OnReleaseInstance()
        {
            EmptyService    instance = new EmptyService();
            InstanceContext context  = new InstanceContext(instance);

            InstanceContext       seenContext  = null;
            object                seenInstance = null;
            SHttpInstanceProvider provider     = new SHttpInstanceProvider();

            provider.OnReleaseInstanceInstanceContextObject =
                (ic, i) =>
            {
                seenContext  = ic;
                seenInstance = i;
            };

            provider.ReleaseInstance(context, instance);

            Assert.AreSame(context, seenContext, "Did not receive context in OnCreateInstance");
            Assert.AreSame(instance, seenInstance, "Did not pass back instance created");
        }
        public void ReleaseInstance_HttpInstanceProvider_Null_InstanceContext_Throws()
        {
            HttpInstanceProvider provider = new SHttpInstanceProvider();

            ExceptionAssert.ThrowsArgumentNull("instanceContext", () => provider.ReleaseInstance(null, "anInstance"));
        }
 public void ReleaseInstance_HttpInstanceProvider_Null_Instance_Throws()
 {
     EmptyService instance = new EmptyService();
     InstanceContext context = new InstanceContext(instance);
     HttpInstanceProvider provider = new SHttpInstanceProvider();
     ExceptionAssert.ThrowsArgumentNull("instance", () => provider.ReleaseInstance(context, null));
 }
 public void ReleaseInstance_HttpInstanceProvider_Null_InstanceContext_Throws()
 {
     HttpInstanceProvider provider = new SHttpInstanceProvider();
     ExceptionAssert.ThrowsArgumentNull("instanceContext", () => provider.ReleaseInstance(null, "anInstance"));
 }
        public void ReleaseInstance_Calls_OnReleaseInstance()
        {
            EmptyService instance = new EmptyService();
            InstanceContext context = new InstanceContext(instance);

            InstanceContext seenContext = null;
            object seenInstance = null;
            SHttpInstanceProvider provider = new SHttpInstanceProvider();
            provider.OnReleaseInstanceInstanceContextObject =
                (ic, i) =>
                {
                    seenContext = ic;
                    seenInstance = i;
                };

            provider.ReleaseInstance(context, instance);

            Assert.AreSame(context, seenContext, "Did not receive context in OnCreateInstance");
            Assert.AreSame(instance, seenInstance, "Did not pass back instance created");
        }