public void GetTableName_ConventionTypeIsClassNameEqualsTableNameConventionIsSet_GetsEntityTypeName() { var attrib = new DbTableNameConventionAttribute(DbTableNameConventionType.ClassNameEqualsTableName); attrib.Convention = "TBL_{0}"; var entity = DateTime.Now; Assert.AreEqual(typeof(DateTime).Name, attrib.GetTableName(entity.GetType())); }
public void GetTableName_ConventionTypeIsCustomAndConventionNotSet_ThrowsInvalidOperationException() { var attrib = new DbTableNameConventionAttribute(DbTableNameConventionType.Custom); attrib.GetTableName(typeof(DateTime)); }
public void Convention_ValueNotOnCorrectType_ThrowArgumentException() { var attrib = new DbTableNameConventionAttribute(DbTableNameConventionType.Custom); attrib.Convention = "SomeConvention"; }
public void GetTableName_ByCustomConvention_ReturnsExpectedTableName() { var attrib = new DbTableNameConventionAttribute(DbTableNameConventionType.Custom); attrib.Convention = "TBL_{0}"; Assert.AreEqual("TBL_DateTime", attrib.GetTableName(typeof(DateTime))); }
public void Convention_SetToNull_IsSetToNull() { var attrib = new DbTableNameConventionAttribute(DbTableNameConventionType.Custom); attrib.Convention = null; Assert.IsNull(attrib.Convention); }