public void ShouldGetAllMappings() { using (SampleContext emptyContext = new XmlFileContext <SampleContext>(this.GetType()).Empty()) { var entityMappings = emptyContext.GetMappings(); entityMappings.Count.ShouldBe(3); entityMappings.Where(t => t.Table == "AUTHOR").FirstOrDefault().ShouldNotBe(null); entityMappings.Where(t => t.Table == "COMMENT").FirstOrDefault().ShouldNotBe(null); entityMappings.Where(t => t.Table == "POST").FirstOrDefault().ShouldNotBe(null); } }
public void ShouldGetMappings() { using (SampleContext emptyContext = new XmlFileContext <SampleContext>(this.GetType()).Empty()) { var entityMapping = emptyContext.GetMappings <Author>(); entityMapping.Table.ShouldBe("AUTHOR"); entityMapping.Entity.ShouldBe("Author"); entityMapping.PropertiesMapping.Count().ShouldBe(4); entityMapping.MappedColumn("FirstName").ShouldBe("AUT_FIRSTNAME"); entityMapping.MappedProperty("AUT_FIRSTNAME").ShouldBe("FirstName"); entityMapping.MappedColumn("Id").ShouldBe("AUT_ID"); entityMapping.MappedProperty("AUT_ID").ShouldBe("Id"); //from table name entityMapping = emptyContext.GetMappings("AUTHOR"); entityMapping.Entity.ShouldBe("Author"); entityMapping.ClrType.ShouldBe(typeof(Author)); } }
public void ShouldGetMappings() { using (SampleContext emptyContext = new XmlFileContext<SampleContext>(this.GetType()).Empty()) { var entityMapping = emptyContext.GetMappings<Author>(); entityMapping.Table.ShouldBe("AUTHOR"); entityMapping.Entity.ShouldBe("Author"); entityMapping.PropertiesMapping.Count().ShouldBe(4); entityMapping.MappedColumn("FirstName").ShouldBe("AUT_FIRSTNAME"); entityMapping.MappedProperty("AUT_FIRSTNAME").ShouldBe("FirstName"); entityMapping.MappedColumn("Id").ShouldBe("AUT_ID"); entityMapping.MappedProperty("AUT_ID").ShouldBe("Id"); //from table name entityMapping = emptyContext.GetMappings("AUTHOR"); entityMapping.Entity.ShouldBe("Author"); entityMapping.ClrType.ShouldBe(typeof(Author)); } }