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