Exemplo n.º 1
0
        public void FromDictionary_EmptyObject_PopulateObject()
        {
            var item = new SimpleFake
            {
                A = null,
                B = null,
                C = null,
                D = null,
                E = null
            };

            IDictionary <string, object> itemDictionary =
                new Dictionary <string, object>(StringComparer.CurrentCultureIgnoreCase)
            {
                { "a", "a value" },
                { "b", 5 },
                { "c", 11.11 },
                { "d", new int[] { 1, 2, 3, 4, 5 } },
                { "e", "Hello world!".ToCharArray() }
            };

            object o = itemDictionary.FromDictionary(item);

            Assert.IsTrue(o.HasValidProperties());
        }
Exemplo n.º 2
0
        public void GetUnderlyingType_CustomReferenceType_ReturnsType()
        {
            var collection = new SimpleFake[]
            {
                Helper.GetSimpleFake(),
                Helper.GetSimpleFake()
            };

            Type underlyingType = collection.GetUnderlyingType();

            Assert.AreEqual(underlyingType, typeof(SimpleFake));
        }