public void ForceInitialize_UnitTest()
 {
     ExecuteMethod(
         () => { ForceInitialize_PreCondition(); },
         () => { MappedObjectInitializer.ForceInitialize(); },
         () => { ForceInitialize_PostValidate(); });
 }
Example #2
0
        public void AnExceptionIsThrownIfATypeHasACreateMapMethodButNoAttributeInStrictMode()
        {
            var typesToIgnore = new List <Type>()
            {
                typeof(MappedObjectWithCreateMapMethod),
                typeof(MappedObjectWithCreateMapMethodWhichThrowsException),
                typeof(MappedObjectWithoutCreateMapMethod)
            };

            MappedObjectInitializer.Initialize(typeof(MappedObjectTest).Assembly, typesToIgnore, true);
        }
Example #3
0
        public void AnExceptionIsThrownIfAMappingInitializerThrowsAnException()
        {
            int initialCount = MappedObjectWithCreateMapMethod.CreateMapCount;

            var typesToIgnore = new List <Type>()
            {
                typeof(MappedObjectInitializer),
                typeof(MappedObjectWithCreateMapMethod),
                typeof(ObjectWithCreateMapMethodButNoAttribute)
            };

            MappedObjectInitializer.Initialize(typeof(MappedObjectTest).Assembly, typesToIgnore, true);
        }
Example #4
0
        public void AnExceptionIsNotThrownIfATypeHasACreateMapMethodButNoAttributeInStrictMode()
        {
            var typesToIgnore = new List <Type>()
            {
                typeof(MappedObjectWithCreateMapMethod),
                typeof(MappedObjectWithCreateMapMethodWhichThrowsException),
                typeof(MappedObjectWithoutCreateMapMethod)
            };

            List <Type> success = MappedObjectInitializer.Initialize(typeof(MappedObjectTest).Assembly, typesToIgnore, false);

            Assert.That(success.Count, Is.EqualTo(0));
        }
Example #5
0
        public void TheCreateMapMethodIsCalledOnTypesWithACreateMapMethodAndAttribute()
        {
            int initialCount = MappedObjectWithCreateMapMethod.CreateMapCount;

            var typesToIgnore = new List <Type>()
            {
                typeof(MappedObjectWithCreateMapMethodWhichThrowsException),
                typeof(MappedObjectWithoutCreateMapMethod),
                typeof(ObjectWithCreateMapMethodButNoAttribute)
            };

            List <Type> success = MappedObjectInitializer.Initialize(typeof(MappedObjectTest).Assembly, typesToIgnore, true);

            Assert.That(success.Count, Is.EqualTo(1));
            Assert.That(success.First(), Is.EqualTo(typeof(MappedObjectWithCreateMapMethod)));
            Assert.That(MappedObjectWithCreateMapMethod.CreateMapCount, Is.GreaterThan(initialCount));
        }
Example #6
0
 public static void Assembly_Initialize(TestContext context)
 {
     MappedObjectInitializer.ForceInitialize(typeof(AttachmentWrapper).Assembly);
 }
Example #7
0
 static APIFactory()
 {
     MappedObjectInitializer.ForceInitialize(Assembly.GetExecutingAssembly());
 }