public void Create_Property_MapToInvalidProperty_Throws() { var definition = TestListDefinition.Create <Request, Item, Result2>(); var expression = new RowsExpression <Request, Result2>(x => x.Rows); definition.RowsDefinition = expression; Factory.Invoking(x => x.Create(definition)) .Should() .ThrowExactly <PropertyNotFoundException>(); }
public void Create_Name_DefaultValueByAttribute_Succeeds() { var definition = TestListDefinition.Create <Request2, Item, Result>(); var expression = new RowsExpression <Request2, Result>("Rows"); definition.RowsDefinition = expression; var configuration = Factory.Create(definition); configuration.RequestProperty.Name.Should().Be("Rows"); configuration.ResultProperty.Name.Should().Be("Rows"); configuration.DefaultValue.Should().Be(30); configuration.Name.Should().BeNull(); }
public void Create_Name_Unmatched_DefaultValue_Succeeds() { var definition = TestListDefinition.Create <Request3, Item, Result>(); var expression = new RowsExpression <Request3, Result>("Rows"); ((IRowsExpression)expression).DefaultValue(2); definition.RowsDefinition = expression; var configuration = Factory.Create(definition); configuration.RequestProperty.Should().BeNull(); configuration.ResultProperty.Should().BeNull(); configuration.DefaultValue.Should().Be(2); configuration.Name.Should().Be("Rows"); }
public void Create_Property_MapTo_Property_Succeeds() { var definition = TestListDefinition.Create <Request, Item, Result2>(); var expression = new RowsExpression <Request, Result2>(x => x.Rows); expression.MapTo(x => x.CurrentRows); definition.RowsDefinition = expression; var configuration = Factory.Create(definition); configuration.RequestProperty.Name.Should().Be("Rows"); configuration.ResultProperty.Name.Should().Be("CurrentRows"); configuration.DefaultValue.Should().Be(25); configuration.Name.Should().BeNull(); }