I’m trying to write a unit test for an aspect GridAspect
public readonly partial struct GridAspect : IAspect
{
private readonly RefRW<GridItems> _gridItems;
private readonly RefRO<GridProperties> _gridProperties;
/// <summary>
///
/// </summary>
/// <param name="index"></param>
private Entity this[int index]
{
get => _gridItems.ValueRO.Items[index];
set => _gridItems.ValueRW.Items[index] = value;
}
/// <summary>
///
/// </summary>
/// <param name="index"></param>
/// <param name="item"></param>
/// <returns></returns>
public bool TryGetItem(int index, out Entity item)
{
if (InArray(index))
{
item = this[index];
return true;
}
item = default;
return false;
}
/// <summary>
///
/// </summary>
/// <param name="index"></param>
/// <param name="entity"></param>
public bool TrySetItem(int index, Entity entity)
{
if (InArray(index))
{
this[index] = entity;
return true;
}
return false;
}
/// <summary>
/// Check to make sure index is in the
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public bool InArray(int index) => 0 <= index && index < Count;
}
But Im not sure how to mock out RefRW
RefRO
or how to set the read-only fields
Is there a framework for testing Aspects?