public void GenerateTypes_should_load_type_from_disk_default_location() { generator = new PocoEmitGenertor(true); var result = generator.GenerateTypes(new ITypeDescription[] { new TypeDescription("Type", new List <IPropertyDescription>() { new PropertyDescription("Prop", typeof(int)) }) }, typeMapper); Assert.NotNull(result); var first = result.Single(); Assert.NotNull(first.Type); Assert.NotNull(first.Type.Assembly.Location); }
public void GenerateTypes_should_load_type_from_disk() { generator = new PocoEmitGenertor("test.dll"); var result = generator.GenerateTypes(new ITypeDescription[] { new TypeDescription("Type", new List <IPropertyDescription>() { new PropertyDescription("Prop", typeof(int)) }) }, typeMapper); Assert.NotNull(result); var first = result.Single(); Assert.NotNull(first.Type); Console.WriteLine(first.Type.Assembly.Location); StringAssert.Contains("test.dll", first.Type.Assembly.Location); }
public void GenerateTypes_should_generate_default_constructor() { var result = generator.GenerateTypes(new [] { typeDescription }, typeMapper).FirstOrDefault(); Assert.NotNull(result); Assert.AreEqual(result.TypeDescription, result.TypeDescription); dynamic instance = Activator.CreateInstance(result.Type); instance.Number = 123; instance.Text = "456"; Assert.AreEqual(123, instance.Number); Assert.AreEqual("456", instance.Text); }
public void GenerateTypes_should_load_type_from_disk() { generator = new PocoEmitGenertor("test.dll"); var result = generator.GenerateTypes(new ITypeDescription[] { new TypeDescription("Type", new List<IPropertyDescription>() { new PropertyDescription("Prop", typeof(int)) }) }, typeMapper); Assert.NotNull(result); var first = result.Single(); Assert.NotNull(first.Type); Console.WriteLine(first.Type.Assembly.Location); StringAssert.Contains("test.dll", first.Type.Assembly.Location); }
public void GenerateTypes_should_load_type_from_disk_default_location() { generator = new PocoEmitGenertor(true); var result = generator.GenerateTypes(new ITypeDescription[] { new TypeDescription("Type", new List<IPropertyDescription>() { new PropertyDescription("Prop", typeof(int)) }) }, typeMapper); Assert.NotNull(result); var first = result.Single(); Assert.NotNull(first.Type); Assert.NotNull(first.Type.Assembly.Location); }