I am using the db4oTool to instrument my classes for transparent activation/persistence. I am using the -ta and -collections switches.
I know how to check that the classes themselves are being properly instrumented by the following test.
Assert.IsTrue(typeof(IActivatable).IsAssignableFrom(typeof(Machine)), "Machine class not instrumented");
However I do not know how to check that my collections are being instrumented correctly.
Given the following machine class:
public class Machine : DomainBase
{
private string _machineId;
public string MachineId
{
get { return _machineId; }
set { _machineId = value; }
}
public IList<EnergyTag> EnergyTags { get; set; }
public void AddEnergyTag(EnergyTag energyTag)
{
if (energyTag.Machine == null)
energyTag.Machine = this;
if (EnergyTags == null)
EnergyTags = new List<EnergyTag>();
EnergyTags.Add(energyTag);
}
}
How would I test that the EnergyTags collection was properly instrumented?
Edit:
Solution:
var machine = new Machine();
Assert.IsTrue(machine.EnergyTags.GetType().Equals(typeof(ActivatableList<EnergyTag>)));