Tynamix / ObjectFiller.NET

The .NET ObjectFiller fills the properties of your .NET objects with random data

Home Page:http://objectfiller.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filler cannot instantiate classes with bool? types

lukaskl opened this issue · comments

if I have class like this:

class TestClass
{
    public int? MyNullableInt { get; set; }
    public bool MyBool { get; set; }
}

everything seems fine, and filler creates new instance

new Filler<TestClass>().Create(); //everything OK! :)

but if I change bool to bool?

class TestClass
{
    public int? MyNullableInt { get; set; }
    public bool? MyNullableBool { get; set; }
}

Filler crashes

new Filler<TestClass>().Create(); //System.Exception was thrown (with message, The type [Nullable`1] was not registered in the randomizer.) 

Of course, I can work around this, by writing

var filler = new Filler<TestClass>();
filler.Setup().OnType<bool?>().Use(new bool[] { true, false });
var testClass = filler.Create();

but I believe that to do so should not be necessary

Thank you for this issue... And you are right... its a bug... ;) ... I'll fix that with the next upcoming release!