in code/KustoCopyTest/InMemoryCache/BlockTest.cs [11:52]
public void UpdateEmptyBlock()
{
var cache = new RowItemInMemoryCache(Array.Empty<RowItemBase>());
var iterationId = 1;
var state1 = BlockState.Planned;
var state2 = BlockState.Exporting;
var blockId = 1;
var item = new BlockRowItem
{
State = state1,
ActivityName = ACTIVITY_NAME,
IterationId = iterationId,
BlockId = blockId
};
cache = cache.AppendItem(new ActivityRowItem
{
State = ActivityState.Active,
ActivityName = ACTIVITY_NAME,
SourceTable = SOURCE_TABLE_IDENTITY,
DestinationTable = DESTINATION_TABLE_IDENTITY
});
cache = cache.AppendItem(new IterationRowItem
{
State = IterationState.Starting,
ActivityName = ACTIVITY_NAME,
IterationId = iterationId,
CursorEnd = "ABC"
});
cache = cache.AppendItem(item);
Assert.Equal(
state1,
cache.ActivityMap[ACTIVITY_NAME].IterationMap[iterationId].BlockMap[blockId].RowItem.State);
// Update
cache = cache.AppendItem(item.ChangeState(state2));
Assert.Equal(
state2,
cache.ActivityMap[ACTIVITY_NAME].IterationMap[iterationId].BlockMap[blockId].RowItem.State);
}