-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
Description
ISSUE: When a class derive from a class that derive from another class, then all the properties is not filled as expected.
public class BaseId
{
public string Id { get; set; }
}
public class BaseWithAudit : BaseId
{
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
}
public class Person : BaseWithAudit
{
public string Name { get; set; }
public string LastName { get; set; }
}
Using the above classes to create a basic unit test, the test fails if the derived class have a base implementation of more than one level.
var filler = new Filler<Person>();
var x = filler.Create();
x.Name.Should().NotBeNullOrEmpty();
x.LastName.Should().NotBeNullOrEmpty();
x.CreatedBy.Should().NotBeNullOrEmpty();
x.UpdatedBy.Should().NotBeNullOrEmpty();
x.Id.Should().NotBeNullOrEmpty();
resulting in:
x.Name = "Bibirit"
x.LastName = "Kubuna"
x.CreatedBy= "Gucutazijaz"
x.UpdatedBy= "Fip"
x.Id= "" ==> expected a value here
The same code just with one base class:
var filler = new Filler<BaseWithAudit>();
var x = filler.Create();
x.CreatedBy.Should().NotBeNullOrEmpty();
x.UpdatedBy.Should().NotBeNullOrEmpty();
x.Id.Should().NotBeNullOrEmpty();
All values filled as expected:
x.CreatedBy= "Bonotubirikid"
x.UpdatedBy= "Higevoka"
x.Id= "Wuf" ==>value populated as expected
endyprekpalaj