private static void Setup() { // MappedCompleteTable ClassMapper.Add <MappedCompleteTable>("[dbo].[COMPLETETABLE]", true); PrimaryMapper.Add <MappedCompleteTable>(e => e.SessionIdMapped, true); PropertyMapper.Add <MappedCompleteTable>(e => e.SessionIdMapped, "SESSIONID", true); PropertyMapper.Add <MappedCompleteTable>(e => e.ColumnBigIntMapped, "COLUMNBIGINT", true); PropertyMapper.Add <MappedCompleteTable>(e => e.ColumnBitMapped, "COLUMNBIT", true); PropertyMapper.Add <MappedCompleteTable>(e => e.ColumnIntMapped, "COLUMNINT", true); PropertyMapper.Add <MappedCompleteTable>(e => e.ColumnDateTimeMapped, "COLUMNDATETIME", true); PropertyMapper.Add <MappedCompleteTable>(e => e.ColumnDateTime2Mapped, "COLUMNDATETIME2", true); PropertyMapper.Add <MappedCompleteTable>(e => e.ColumnNVarCharMapped, "COLUMNNVARCHAR", true); // MappedCompleteTable ClassMapper.Add <MappedIdentityTable>("[sc].[IDENTITYTABLE]", true); PrimaryMapper.Add <MappedIdentityTable>(e => e.IdMapped, true); PropertyMapper.Add <MappedIdentityTable>(e => e.IdMapped, "ID", true); PropertyMapper.Add <MappedIdentityTable>(e => e.RowGuidMapped, "ROWGUID", true); PropertyMapper.Add <MappedIdentityTable>(e => e.ColumnBitMapped, "COLUMNBIT", true); PropertyMapper.Add <MappedIdentityTable>(e => e.ColumnIntMapped, "COLUMNINT", true); PropertyMapper.Add <MappedIdentityTable>(e => e.ColumnDateTimeMapped, "COLUMNDATETIME", true); PropertyMapper.Add <MappedIdentityTable>(e => e.ColumnDateTime2Mapped, "COLUMNDATETIME2", true); PropertyMapper.Add <MappedIdentityTable>(e => e.ColumnFloatMapped, "COLUMNFLOAT", true); PropertyMapper.Add <MappedIdentityTable>(e => e.ColumnNVarCharMapped, "COLUMNNVARCHAR", true); // MappedCompleteTableForKey ClassMapper.Add <MappedCompleteTableForKey>("[dbo].[COMPLETETABLE]", true); PropertyMapper.Add <MappedCompleteTableForKey>(e => e.IdMapped, "SESSIONID", true); }
public void TestPropertyMapperMappingViaColumnAttributeViaExpressionWithMapAttribute() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>(e => e.PropertyString, "ColumnText"); // Act var actual = PropertyMappedNameCache.Get <PropertyMapperColumnAttributeClass>(e => e.PropertyString); var expected = "PropertyText"; // Assert Assert.AreEqual(expected, actual); }
public void TestPropertyMapperMappingViaExpression() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, "PropertyString"); // Act var actual = PropertyMappedNameCache.Get <PropertyMapperTestClass>(e => e.ColumnString); var expected = "PropertyString"; // Assert Assert.AreEqual(expected, actual); }
public void TestPropertyMapperMappingViaPropertyNameWithMapAttribute() { // Setup var propertyName = "PropertyString"; PropertyMapper.Add <PropertyMapperTestClass>(propertyName, "ColumnText"); // Act var actual = PropertyMappedNameCache.Get <PropertyMapperTestClass>(propertyName); var expected = "PropertyText"; // Assert Assert.AreEqual(expected, actual); }
public void TestPropertyMapperMappingViaColumnAttributeViaFieldWithMapAttribute() { // Setup var field = new Field("PropertyString"); PropertyMapper.Add <PropertyMapperColumnAttributeClass>(field, "ColumnText"); // Act var actual = PropertyMappedNameCache.Get <PropertyMapperColumnAttributeClass>(field); var expected = "PropertyText"; // Assert Assert.AreEqual(expected, actual); }
public void TestPropertyMapperMappingViaField() { // Setup var field = new Field("ColumnString"); PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), "PropertyString"); // Act var actual = PropertyMappedNameCache.Get <PropertyMapperTestClass>(field); var expected = "PropertyString"; // Assert Assert.AreEqual(expected, actual); }
public void TestPropertyMapperMappingViaColumnAttributeViaPropertyNameOverride() { // Setup var propertyName = "ColumnString"; PropertyMapper.Add <PropertyMapperColumnAttributeClass>(propertyName, "PropertyString"); PropertyMapper.Add <PropertyMapperColumnAttributeClass>(propertyName, "PropertyText", true); // Act var actual = PropertyMappedNameCache.Get <PropertyMapperColumnAttributeClass>(propertyName); var expected = "PropertyText"; // Assert Assert.AreEqual(expected, actual); }
public void ThrowExceptionOnPropertyMapperViaExpressionWithEmptySpacesTargetColumnName() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, " "); }
public void ThrowExceptionOnPropertyMapperViaFieldWithEmptySpacesTargetColumnName() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), " "); }
public void ThrowExceptionOnPropertyMapperViaPropertyNameWithEmptyTargetColumnName() { // Setup PropertyMapper.Add <PropertyMapperTestClass>("ColumnString", ""); }
public void ThrowExceptionOnPropertyMapperViaFieldThatIsIsMissing() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(new Field("Whatever"), "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaPropertyNameThatIsMissing() { // Setup PropertyMapper.Add <PropertyMapperTestClass>("Whatever", "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaFieldWithEmptyTargetColumnName() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>(new Field("ColumnString"), ""); }
public void ThrowExceptionOnPropertyMapperViaFieldThatIsNull() { // Setup PropertyMapper.Add <PropertyMapperTestClass>((Field)null, "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaPropertyNameThatIsNull() { // Setup PropertyMapper.Add <PropertyMapperTestClass>((string)null, "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaPropertyNameThatIsAlreadyExisting() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>("ColumnString", "PropertyString"); PropertyMapper.Add <PropertyMapperColumnAttributeClass>("ColumnString", "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaFieldThatIsAlreadyExisting() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), "PropertyString"); PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaFieldThatIsNull() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>((Field)null, "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaPropertyNameWithEmptySpacesTargetColumnName() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>("ColumnString", " "); }
public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaExpressionWithEmptyTargetColumnName() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>(e => e.ColumnString, ""); }
public void ThrowExceptionOnPropertyMapperViaExpressionThatIsNull() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(expression: null, columnName: "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaExpressionThatIsAlreadyExisting() { // Setup PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, "PropertyString"); PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, "PropertyText"); }
public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaPropertyNameThatIsMissing() { // Setup PropertyMapper.Add <PropertyMapperColumnAttributeClass>("Whatever", "PropertyText"); }