public void TestPropertyHandlerWithAttributePrecedenceOnQueryGroupExpression() { // Prepare var propertyHandler = new Mock <IPropertyHandler <int, int> >(); FluentMapper .Entity <PropertyHandlerTestClassWithAttributeForQueryGroup>() .PropertyHandler(e => e.Id, propertyHandler.Object); // Act using (var connection = new PropertyHandlerConnection()) { connection.Query <PropertyHandlerTestClassWithAttributeForQueryGroup>(new QueryGroup(new QueryField("Id", 1))); } // Assert propertyHandler.Verify(c => c.Set(It.IsAny <int>(), It.IsAny <ClassProperty>()), Times.Never); }
public void TestPropertyHandlerPrecedenceOnQueryFieldsExpression() { // Prepare var propertyHandler = new Mock <IPropertyHandler <int, int> >(); FluentMapper .Entity <PropertyHandlerTestClassForQueryFields>() .PropertyHandler(e => e.Id, propertyHandler.Object); // Act using (var connection = new PropertyHandlerConnection()) { connection.Query <PropertyHandlerTestClassForQueryFields>((new QueryField("Id", 1)).AsEnumerable()); } // Assert propertyHandler.Verify(c => c.Set(It.IsAny <int>(), It.IsAny <ClassProperty>()), Times.Once); }
public void TestPropertyHandlerWithAttributePrecedenceOnLinqExpression() { // Prepare var propertyHandler = new Mock <IPropertyHandler <int, int> >(); FluentMapper .Entity <PropertyHandlerTestClassWithAttributeForLinq>() .PropertyHandler(e => e.Id, propertyHandler.Object); // Act using (var connection = new PropertyHandlerConnection()) { connection.Query((Expression <Func <PropertyHandlerTestClassWithAttributeForLinq, bool> >)(e => e.Id == 1)); } // Assert propertyHandler.Verify(c => c.Set(It.IsAny <int>(), It.IsAny <ClassProperty>()), Times.Never); }
public void TestPropertyHandlerPrecedenceOnDynamicExpression() { // Prepare var propertyHandler = new Mock <IPropertyHandler <int, int> >(); FluentMapper .Entity <PropertyHandlerTestClassForDynamic>() .PropertyHandler(e => e.Id, propertyHandler.Object); // Act using (var connection = new PropertyHandlerConnection()) { connection.Query <PropertyHandlerTestClassForDynamic>(new { Id = 1 }); } // Assert propertyHandler.Verify(c => c.Set(It.IsAny <int>(), It.IsAny <ClassProperty>()), Times.Once); }
public void TestPropertyHandlerInvocationOnPrimaryKey() { // Prepare var propertyHandler = new Mock <IPropertyHandler <int, int> >(); FluentMapper .Entity <PropertyHandlerTestClassForPrimaryKey>() .PropertyHandler(e => e.Id, propertyHandler.Object); // Act using (var connection = new PropertyHandlerConnection()) { connection.Query <PropertyHandlerTestClassForPrimaryKey>(1); } // Assert propertyHandler.Verify(c => c.Set(It.IsAny <int>(), It.IsAny <ClassProperty>()), Times.Once); }