public void IteratingOverBoxedNoAllocReadOnlyCollectionThrows()
        {
            var sourceList         = Enumerable.Range(1, 10).ToList();
            var readOnlyCollection = new World.NoAllocReadOnlyCollection <int>(sourceList);

            var ex  = Assert.Throws <NotSupportedException>(() => ((IEnumerable <int>)readOnlyCollection).GetEnumerator());
            var ex2 = Assert.Throws <NotSupportedException>(() => ((IEnumerable)readOnlyCollection).GetEnumerator());

            Assert.That(ex.Message, Is.EqualTo($"To avoid boxing, do not cast {nameof(World.NoAllocReadOnlyCollection<int>)} to IEnumerable<T>."));
            Assert.That(ex2.Message, Is.EqualTo($"To avoid boxing, do not cast {nameof(World.NoAllocReadOnlyCollection<int>)} to IEnumerable."));
        }
        public override void InitBehaviour()
        {
            // Get the world and entity manager
            world         = World.All;
            entityManager = world[0].EntityManager;

            // Root element of UI
            rootVisualElement = GetComponent <UIDocument>().rootVisualElement;

            bottomPanel = GetComponent <UIDocument>().rootVisualElement.Q("BottomBar");
            topPanel    = GetComponent <UIDocument>().rootVisualElement.Q("ResourceBar");

            // Minimap
            minimap       = rootVisualElement.Q <Image>("MapImage");
            minimap.image = miniMapRenderTexture;

            // Resources
            resource1Text = rootVisualElement.Q <Label>("Resource1Text");
            resource2Text = rootVisualElement.Q <Label>("Resource2Text");
            resource3Text = rootVisualElement.Q <Label>("Resource3Text");

            // Selected Units
            unitGrid = GetComponent <UIDocument>().rootVisualElement.Q("UnitGrid");

            // unit selection, excluding enemies
            selectedQuery = entityManager.CreateEntityQuery(ComponentType.ReadWrite <SelectedTag>(), ComponentType.Exclude <EnemyTag>());

            selectionSystem = world[0].GetExistingSystem <SelectionSystem>();

            // Action Buttons
            buttonGrid = GetComponent <UIDocument>().rootVisualElement.Q("ButtonGrid");
            for (int i = 0; i < 3; i++)
            {
                AddToButtons();
            }

            // hoveredUnit = TODO: implemented when an onHover is implemented on a UI "unit"
            mainUnit = GetComponent <UIDocument>().rootVisualElement.Q("MainUnit");
        }