public void TestIdentityMapperMappingViaExpressionForBaseProperty() { // Derived 1 // Setup IdentityMapper.Add <IdentityMapperTestDerivedClass1>(e => e.ColumnId); // Act var actual = IdentityMapper.Get <IdentityMapperTestDerivedClass1>(); var expected = "ColumnId"; // Assert Assert.IsTrue(actual?.IsIdentity() == true); Assert.AreEqual(expected, actual?.GetMappedName()); // Derived 2 // Setup IdentityMapper.Add <IdentityMapperTestDerivedClass2>(e => e.ColumnId); // Act actual = IdentityMapper.Get <IdentityMapperTestDerivedClass2>(); expected = "ColumnId"; // Assert Assert.IsTrue(actual?.IsIdentity() == true); Assert.AreEqual(expected, actual?.GetMappedName()); }
public void TestClassMapIdentityMappingOverride() { // Setup IdentityMapper.Add <ClassMapperTestClass>(e => e.RowId, true); // Act var actual = IdentityCache.Get <ClassMapperTestClass>(); var expected = "RowId"; // Assert Assert.AreEqual(expected, actual.GetMappedName()); }
public void TestIdentityMapperMappingViaExpression() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(e => e.ColumnInt); // Act var actual = IdentityMapper.Get <IdentityMapperTestClass>(); var expected = "ColumnInt"; // Assert Assert.IsTrue(actual?.IsIdentity() == true); Assert.AreEqual(expected, actual?.GetMappedName()); }
public void TestIdentityMapperMappingViaFieldOverride() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(new Field("ColumnInt")); IdentityMapper.Add <IdentityMapperTestClass>(new Field("ColumnString"), true); // Act var actual = IdentityMapper.Get <IdentityMapperTestClass>(); var expected = "ColumnString"; // Assert Assert.IsTrue(actual?.IsIdentity() == true); Assert.AreEqual(expected, actual?.GetMappedName()); }
public void TestIdentityMapperMappingViaFieldWithMapAttribute() { // Setup IdentityMapper.Add <IdentityMapperTestWithAttributeClass>(new Field("ColumnInt")); // Act var actual = IdentityMapper.Get <IdentityMapperTestWithAttributeClass>(); var expected = "ColumnInt"; // Assert Assert.IsTrue(actual?.IsIdentity() == true); Assert.AreEqual(expected, actual?.GetMappedName()); // Act actual = IdentityCache.Get <IdentityMapperTestWithAttributeClass>(); expected = "ColumnString"; // Assert Assert.IsTrue(actual?.IsIdentity() == true); Assert.AreEqual(expected, actual?.GetMappedName()); }
public void ThrowExceptionOnClassMapIdentityMappingThatIsAlreadyExisting() { // Setup IdentityMapper.Add <ClassMapperTestClass>(e => e.RowId); }
public void ThrowExceptionOnIdentityMapperViaFieldThatIsIsMissing() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(new Field("Whatever")); }
public void ThrowExceptionOnIdentityMapperViaPropertyNameThatIsMissing() { // Setup IdentityMapper.Add <IdentityMapperTestClass>("Whatever"); }
public void ThrowExceptionOnIdentityMapperViaFieldThatIsEmptySpaces() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(field: new Field(" ")); }
public void ThrowExceptionOnIdentityMapperViaPropertyNameThatIsEmptySpaces() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(propertyName: " "); }
public void ThrowExceptionOnIdentityMapperViaExpressionThatIsNull() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(expression: null); }
public void ThrowExceptionOnIdentityMapperViaFieldThatIsNull() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(field: null); }
public void ThrowExceptionOnIdentityMapperViaPropertyNameThatIsNull() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(propertyName: null); }
public void ThrowExceptionOnIdentityMapperViaExpressionThatIsAlreadyExisting() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(e => e.ColumnInt); IdentityMapper.Add <IdentityMapperTestClass>(e => e.ColumnString); }
public void ThrowExceptionOnIdentityMapperViaFieldThatIsAlreadyExisting() { // Setup IdentityMapper.Add <IdentityMapperTestClass>(new Field("ColumnInt")); IdentityMapper.Add <IdentityMapperTestClass>(new Field("ColumnString")); }
public void ThrowExceptionOnIdentityMapperViaPropertyNameThatIsAlreadyExisting() { // Setup IdentityMapper.Add <IdentityMapperTestClass>("ColumnInt"); IdentityMapper.Add <IdentityMapperTestClass>("ColumnString"); }