public void BuilderShouldHandleMultipleFields() { layout.WithMember(o => o.Id, set => set.WithLength(4).WithConverter <IdHexConverter>()) .WithMember(o => o.Description, set => set.WithLength(7)); var entry = new TestObject { Id = 48879, Description = "testing" }; var line = builder.BuildLine(entry); line.Should().Be("BEEFtesting"); }
public void FieldsCountAfterReplacementShouldNotChange() { layout.WithMember(o => o.NullableInt, set => set.WithLength(5).AllowNull(string.Empty).WithLeftPadding('0')); layout.Fields.Should().HaveCount(3); }
public void ParserShouldReadAnyValidString(string inputString, int id, string description, int?nullableInt, string note) { layout.WithMember(o => o.Id, set => set.WithLength(5).WithLeftPadding('0')) .WithMember(o => o.Description, set => set.WithLength(25).WithRightPadding(' ')) .WithMember(o => o.NullableInt, set => set.WithLength(5).AllowNull("=Null").WithLeftPadding('0')) .WithMember(o => o.Note, set => set.WithLength(7).WithRightPadding(' ')); var parsedEntity = parser.ParseLine(inputString, new TestObject()); parsedEntity.Id.Should().Be(id); parsedEntity.Description.Should().Be(description); parsedEntity.NullableInt.Should().Be(nullableInt); parsedEntity.Note.Should().Be(note); }