public void Contains_Index(int?start, int?end, int step, int index, bool?expected)
        {
            var range = new IndexRange(start, end, step);

            bool?actual = range.Contains(index);

            actual.Should().Be(expected);
        }
        public void Contains_IndexRange(int?start, int?end, int step, int?otherStart, int?otherEnd, int otherStep, bool?expected)
        {
            var range = new IndexRange(start, end, step);
            var other = new IndexRange(otherStart, otherEnd, otherStep);

            bool?actual = range.Contains(other);

            actual.Should().Be(expected);
        }
Example #3
0
 public void SetVisibleItems(ItemsVisibilityChangedEvent e, ScreenNode screen, [JoinAll] ICollection <BattleNode> battles)
 {
     screen.Entity.RemoveComponent <VisibleItemsRangeComponent>();
     screen.Entity.AddComponent(new VisibleItemsRangeComponent(e.Range));
     foreach (BattleNode node in battles)
     {
         int        indexInSearchResult = node.searchData.IndexInSearchResult;
         IndexRange range = e.Range;
         if (!range.Contains(indexInSearchResult) && e.PrevRange.Contains(indexInSearchResult))
         {
             base.Log.InfoFormat("RemoveVisibleItem {0}", node.Entity.Id);
             node.Entity.RemoveComponent <VisibleItemComponent>();
             continue;
         }
         if (e.Range.Contains(indexInSearchResult) && !e.PrevRange.Contains(indexInSearchResult))
         {
             base.Log.InfoFormat("AddVisibleItem {0}", node.Entity.Id);
             node.Entity.AddComponent <VisibleItemComponent>();
         }
     }
 }