Skip to content

Setting defaults in constructor when creating lists causes exception #40

Closed
@ruapho

Description

@ruapho

Hi,

this code will raise a System.ArgumentNullException:

    public class Test
    {
        public int SetMe { get; set; }
    }

    public class TestBuilder : TestDataBuilder<Test, TestBuilder>
    {
        public TestBuilder()
        {
            this.Set(x => x.SetMe, 5);
        }
    }

    public class TestSpecification
    {
        Establish context = () =>
            {
                var test = TestBuilder.CreateListOfSize(2).BuildList();
            };
    }

this succeeds:

var test = new TestBuilder().Build();

Any ideas? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions