示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
 public void ThrowExceptionOnPropertyMapperViaExpressionWithEmptySpacesTargetColumnName()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, "  ");
 }
示例#9
0
 public void ThrowExceptionOnPropertyMapperViaFieldWithEmptySpacesTargetColumnName()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), "  ");
 }
示例#10
0
 public void ThrowExceptionOnPropertyMapperViaPropertyNameWithEmptyTargetColumnName()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>("ColumnString", "");
 }
示例#11
0
 public void ThrowExceptionOnPropertyMapperViaFieldThatIsIsMissing()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>(new Field("Whatever"), "PropertyText");
 }
示例#12
0
 public void ThrowExceptionOnPropertyMapperViaPropertyNameThatIsMissing()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>("Whatever", "PropertyText");
 }
示例#13
0
 public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaFieldWithEmptyTargetColumnName()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>(new Field("ColumnString"), "");
 }
示例#14
0
 public void ThrowExceptionOnPropertyMapperViaFieldThatIsNull()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>((Field)null, "PropertyText");
 }
示例#15
0
 public void ThrowExceptionOnPropertyMapperViaPropertyNameThatIsNull()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>((string)null, "PropertyText");
 }
示例#16
0
 public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaPropertyNameThatIsAlreadyExisting()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>("ColumnString", "PropertyString");
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>("ColumnString", "PropertyText");
 }
示例#17
0
 public void ThrowExceptionOnPropertyMapperViaFieldThatIsAlreadyExisting()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), "PropertyString");
     PropertyMapper.Add <PropertyMapperTestClass>(new Field("ColumnString"), "PropertyText");
 }
示例#18
0
 public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaFieldThatIsNull()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>((Field)null, "PropertyText");
 }
示例#19
0
 public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaPropertyNameWithEmptySpacesTargetColumnName()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>("ColumnString", "  ");
 }
示例#20
0
 public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaExpressionWithEmptyTargetColumnName()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>(e => e.ColumnString, "");
 }
示例#21
0
 public void ThrowExceptionOnPropertyMapperViaExpressionThatIsNull()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>(expression: null, columnName: "PropertyText");
 }
示例#22
0
 public void ThrowExceptionOnPropertyMapperViaExpressionThatIsAlreadyExisting()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, "PropertyString");
     PropertyMapper.Add <PropertyMapperTestClass>(e => e.ColumnString, "PropertyText");
 }
示例#23
0
 public void ThrowExceptionOnPropertyMapperViaColumnAttributeViaPropertyNameThatIsMissing()
 {
     // Setup
     PropertyMapper.Add <PropertyMapperColumnAttributeClass>("Whatever", "PropertyText");
 }