Exemple #1
0
        public void ShouldCheckIfTypeAlreadyExists()
        {
            Dictionary <string, Type> typeDef = new Dictionary <string, Type>
            {
                { "StringProp", typeof(String) },
                { "IntProp", typeof(int) },
                { "DateProp", typeof(DateTime) },
                { "DoubleNullableProp", typeof(double?) }
            };

            Type t = TypeGenerator.MakeType("TestClassA", typeDef);

            Assert.That(t, Is.Not.Null);

            Type t2 = TypeGenerator.GetType("TestClassA");

            Assert.That(t2, Is.Not.Null);
            Assert.Throws <ArgumentException>(() => TypeGenerator.MakeType("TestClassA", typeDef));

            Assert.That(t2, Is.EqualTo(t));
        }
Exemple #2
0
 public override Type ResolveType()
 {
     return(TypeGenerator.GetType(Name));
 }
Exemple #3
0
 public void GetTypeBeforeEachTest()
 {
     type = TypeGenerator.GetType(wanteType);
 }
Exemple #4
0
 public void InitializeBeforeEachTest()
 {
     type = TypeGenerator.GetType("StorageMaster");
     this.storageMaster = (StorageMaster)Activator.CreateInstance(this.type, new object[] { });
 }