using AutoFixture.Kernel;
public static void Main()
var fixture = new Fixture();
fixture.Customizations.Add(new TypeRelay(typeof(ILamp),typeof(Lamp)));
c => c.With(x => x.IsWorking, true)
.With(x => x.LampModel));
var actual = fixture.Create<MyClass>();
Console.WriteLine(actual.Lamp.IsWorking);
Console.WriteLine(actual.Lamp.LampModel);
bool IsWorking { get; set; }
string LampModel { get; set; }
public class Lamp : ILamp
private string _lampModel;
public bool IsWorking { get; set; }
public string LampModel {
set { _lampModel = IsWorking ? value : throw new Exception("its not in working."); }
public ILamp Lamp {get;set;}