Example #1
0
        public void CloneParametersCopiesValues()
        {
            CloneableObject obj = new CloneableObject();

            obj.Value = new object();

            CloneParameter  cloneParam = new CloneParameter(new ValueParameter <CloneableObject>(obj));
            CloneableObject result     = (CloneableObject)cloneParam.GetValue(null);

            Assert.AreSame(obj.Value, result.Value);
            Assert.AreSame(typeof(CloneableObject), cloneParam.GetParameterType(null));
        }
Example #2
0
        public void CloneParametersReturnsNewObjectOfCorrectType()
        {
            MockBuilderContext ctx = new MockBuilderContext();

            ctx.InnerLocator.Add("foo", new CloneableObject());

            CloneParameter cloneParam = new CloneParameter(new LookupParameter("foo"));

            object result1 = cloneParam.GetValue(ctx);
            object result2 = cloneParam.GetValue(ctx);

            Assert.IsTrue(result1 is CloneableObject);
            Assert.IsTrue(result2 is CloneableObject);
            Assert.IsFalse(result1 == result2);
        }