Exemple #1
0
        public void TypeSpace_ArgumentChecks()
        {
            var ts = new TypeSpace();

            AssertEx.ThrowsException <ArgumentNullException>(() => ts.GetMember(member: null), ex => Assert.AreEqual(ex.ParamName, "member"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.GetConstructor(constructor: null), ex => Assert.AreEqual(ex.ParamName, "constructor"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.GetField(field: null), ex => Assert.AreEqual(ex.ParamName, "field"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.GetMethod(method: null), ex => Assert.AreEqual(ex.ParamName, "method"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.GetProperty(property: null), ex => Assert.AreEqual(ex.ParamName, "property"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.ConvertType(type: null), ex => Assert.AreEqual(ex.ParamName, "type"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.MapType(type: null, typeSlim: null), ex => Assert.AreEqual(ex.ParamName, "type"));
            AssertEx.ThrowsException <ArgumentNullException>(() => ts.MapType(typeof(int), typeSlim: null), ex => Assert.AreEqual(ex.ParamName, "typeSlim"));
        }
Exemple #2
0
        public void TypeSpace_Resolve()
        {
            var ts       = new TypeSpace();
            var longSlim = ts.ConvertType(typeof(long));

            ts.MapType(typeof(int), longSlim);
            Assert.AreEqual(ts.ConvertType(typeof(int)), longSlim);
        }