public void Apply_does_not_invoke_action_when_value_null() { var actionInvoked = false; var convention = new EntityConventionWithHaving <object>( Enumerable.Empty <Func <Type, bool> >(), t => null, (c, v) => actionInvoked = true); var type = new MockType(); var configuration = new EntityTypeConfiguration(type); convention.Apply(type, () => configuration); Assert.False(actionInvoked); }
public void Apply_invokes_action_with_value_when_not_null() { var actionInvoked = false; object capturedValue = null; var value = new object(); var convention = new EntityConventionWithHaving <object>( Enumerable.Empty <Func <Type, bool> >(), t => value, (c, v) => { actionInvoked = true; capturedValue = v; }); var type = new MockType(); var configuration = new EntityTypeConfiguration(type); convention.Apply(type, () => configuration); Assert.True(actionInvoked); Assert.Same(value, capturedValue); }