public void Parameter_should_set_parameter_name_for_valid_property_expressions() { var modificationFunctionConfiguration = new ModificationFunctionConfiguration(); var configuration = new AssociationModificationFunctionConfiguration<Entity>( new MockPropertyInfo(), modificationFunctionConfiguration); configuration.Parameter(e => e.Int, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); modificationFunctionConfiguration.ClearParameterNames(); configuration.Parameter(e => e.Nullable, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); modificationFunctionConfiguration.ClearParameterNames(); configuration.Parameter(e => e.String, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); modificationFunctionConfiguration.ClearParameterNames(); configuration.Parameter(e => e.Bytes, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); }
public void Parameter_should_set_parameter_name_for_valid_property_expressions() { var modificationFunctionConfiguration = new ModificationFunctionConfiguration(); var configuration = new AssociationModificationFunctionConfiguration <Entity>( new MockPropertyInfo(), modificationFunctionConfiguration); configuration.Parameter(e => e.Int, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); modificationFunctionConfiguration.ClearParameterNames(); configuration.Parameter(e => e.Nullable, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); modificationFunctionConfiguration.ClearParameterNames(); configuration.Parameter(e => e.String, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); modificationFunctionConfiguration.ClearParameterNames(); configuration.Parameter(e => e.Bytes, "Foo"); Assert.Equal("Foo", modificationFunctionConfiguration.ParameterNames.Single().Item1); }
public void Association_when_reference_should_invoke_action_with_configuration() { var configuration = new UpdateModificationFunctionConfiguration <Entity>(); AssociationModificationFunctionConfiguration <Entity> associationConfiguration = null; configuration.Association <Entity>(e => e.Parent, c => { associationConfiguration = c; }); Assert.NotNull(associationConfiguration); }
public void Association_when_collection_should_invoke_action_with_configuration() { var configuration = new DeleteModificationFunctionConfiguration <Entity>(); AssociationModificationFunctionConfiguration <Entity> associationConfiguration = null; configuration.Association <Entity>(e => e.Children, c => { associationConfiguration = c; }); Assert.NotNull(associationConfiguration); }
public void Parameter_should_throw_when_complex_property_expression() { var configuration = new AssociationModificationFunctionConfiguration<Entity>( new MockPropertyInfo(), new ModificationFunctionConfiguration()); Assert.Equal( Strings.InvalidPropertyExpression("e => e.ComplexType.Int"), Assert.Throws<InvalidOperationException>( () => configuration.Parameter(e => e.ComplexType.Int, "Foo")).Message); }
public void Parameter_should_return_configuration_for_valid_property_expressions() { var configuration = new AssociationModificationFunctionConfiguration<Entity>( new MockPropertyInfo(), new ModificationFunctionConfiguration()); Assert.Same(configuration, configuration.Parameter(e => e.Int, "Foo")); Assert.Same(configuration, configuration.Parameter(e => e.Nullable, "Foo")); Assert.Same(configuration, configuration.Parameter(e => e.String, "Foo")); Assert.Same(configuration, configuration.Parameter(e => e.Bytes, "Foo")); }
public void Parameter_should_throw_when_complex_property_expression() { var configuration = new AssociationModificationFunctionConfiguration <Entity>( new MockPropertyInfo(), new ModificationFunctionConfiguration()); Assert.Equal( Strings.InvalidPropertyExpression("e => e.ComplexType.Int"), Assert.Throws <InvalidOperationException>( () => configuration.Parameter(e => e.ComplexType.Int, "Foo")).Message); }
public void Parameter_should_return_configuration_for_valid_property_expressions() { var configuration = new AssociationModificationFunctionConfiguration <Entity>( new MockPropertyInfo(), new ModificationFunctionConfiguration()); Assert.Same(configuration, configuration.Parameter(e => e.Int, "Foo")); Assert.Same(configuration, configuration.Parameter(e => e.Nullable, "Foo")); Assert.Same(configuration, configuration.Parameter(e => e.String, "Foo")); Assert.Same(configuration, configuration.Parameter(e => e.Bytes, "Foo")); }