public void UpdateIterationWithChildren()

in code/KustoCopyTest/InMemoryCache/IterationTest.cs [80:124]


        public void UpdateIterationWithChildren()
        {
            var cache = new RowItemInMemoryCache(Array.Empty<RowItemBase>());
            var iterationId = 1;
            var iterationState1 = IterationState.Planning;
            var iterationState2 = IterationState.Planned;
            var blockId = 1;
            var item = new IterationRowItem
            {
                State = iterationState1,
                ActivityName = ACTIVITY_NAME,
                IterationId = iterationId,
                CursorEnd = "ABC"
            };

            cache = cache.AppendItem(new ActivityRowItem
            {
                State = ActivityState.Active,
                ActivityName = ACTIVITY_NAME,
                SourceTable = SOURCE_TABLE_IDENTITY,
                DestinationTable = DESTINATION_TABLE_IDENTITY
            });
            cache = cache.AppendItem(item);
            cache = cache.AppendItem(new BlockRowItem
            {
                State = BlockState.Planned,
                ActivityName = ACTIVITY_NAME,
                IterationId = iterationId,
                BlockId = blockId
            });

            Assert.Equal(
                iterationState1,
                cache.ActivityMap[ACTIVITY_NAME].IterationMap[iterationId].RowItem.State);
            Assert.Single(cache.ActivityMap[ACTIVITY_NAME].IterationMap[iterationId].BlockMap);

            //  Update
            item = item.ChangeState(iterationState2);
            cache = cache.AppendItem(item);

            Assert.Equal(
                iterationState2,
                cache.ActivityMap[ACTIVITY_NAME].IterationMap[iterationId].RowItem.State);
            Assert.Single(cache.ActivityMap[ACTIVITY_NAME].IterationMap[iterationId].BlockMap);
        }