コード例 #1
0
        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));
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        public void ReleaseInstance_HttpInstanceProvider_Null_InstanceContext_Throws()
        {
            HttpInstanceProvider provider = new SHttpInstanceProvider();

            ExceptionAssert.ThrowsArgumentNull("instanceContext", () => provider.ReleaseInstance(null, "anInstance"));
        }
コード例 #4
0
 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));
 }
コード例 #5
0
 public void ReleaseInstance_HttpInstanceProvider_Null_InstanceContext_Throws()
 {
     HttpInstanceProvider provider = new SHttpInstanceProvider();
     ExceptionAssert.ThrowsArgumentNull("instanceContext", () => provider.ReleaseInstance(null, "anInstance"));
 }
コード例 #6
0
        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");
        }