Ejemplo n.º 1
0
        void DetermineMinAndMaxValuesFrom(GenericRangeFilter <T> genericRangeFilter)
        {
            _min = AvailableMinItems.FirstOrDefault(item => item.Value.Equals(genericRangeFilter.Range.MinValue)) ??
                   AvailableMinItems.First();

            _max = AvailableMaxItems.FirstOrDefault(item => item.Value.Equals(genericRangeFilter.Range.MaxValue)) ??
                   AvailableMaxItems.Last();
        }
Ejemplo n.º 2
0
        public void Equals_TwoFiltersWithSameRangeOneActiveOneInactive_ReturnsFalse()
        {
            var genericRange = new GenericRange <int>(0, 1);
            var rangeFilter1 = new GenericRangeFilter <int> {
                Range = genericRange, IsActive = true
            };
            var rangeFilter2 = new GenericRangeFilter <int> {
                Range = genericRange, IsActive = false
            };

            rangeFilter1.ShouldNotBeEqualTo(rangeFilter2);
        }
Ejemplo n.º 3
0
        public void Equals_TwoFiltersWithSameRangeAndBothActive_ReturnsTrue()
        {
            var genericRange = new GenericRange <int>(0, 1);
            var rangeFilter1 = new GenericRangeFilter <int> {
                Range = genericRange, IsActive = true
            };
            var rangeFilter2 = new GenericRangeFilter <int> {
                Range = genericRange, IsActive = true
            };

            rangeFilter1.ShouldBeEqualTo(rangeFilter2);
        }
        public AnalyzablePokerPlayersFilter()
        {
            MFilter                 = new GenericRangeFilter <int>();
            AnteFilter              = new GenericRangeFilter <double>();
            BigBlindFilter          = new GenericRangeFilter <double>();
            TotalPlayersFilter      = new GenericRangeFilter <int>();
            PlayersInFlopFilter     = new GenericRangeFilter <int>();
            StrategicPositionFilter = new GenericRangeFilter <StrategicPositions>();
            TimeRangeFilter         = new GenericRangeFilter <int>();

            _timeStampFilter = new GenericRangeFilter <DateTime>();
        }
Ejemplo n.º 5
0
        public void Equals_TwoFiltersWithDifferentRangesAndBothActive_ReturnsFalse()
        {
            var genericRange1 = new GenericRange <int>(0, 1);
            var genericRange2 = new GenericRange <int>(0, 2);
            var rangeFilter1  = new GenericRangeFilter <int> {
                Range = genericRange1, IsActive = true
            };
            var rangeFilter2 = new GenericRangeFilter <int> {
                Range = genericRange2, IsActive = true
            };

            rangeFilter1.ShouldNotBeEqualTo(rangeFilter2);
        }
Ejemplo n.º 6
0
        public RangeFilterForSelectorsViewModel(
            GenericRangeFilter <T> genericRangeFilter,
            IEnumerable <T> availableValues,
            string filterName,
            Func <T, string> convertValueToDisplay)
            : base(genericRangeFilter, filterName)
        {
            CreateAndPopulateAllAvailableItemsFrom(availableValues, convertValueToDisplay);

            CreateAndPopulateAvailableMinAndMaxItemsFromAllAvailableItems();

            DetermineMinAndMaxValuesFrom(genericRangeFilter);

            AddLegalAndRemoveIllegalMinItems();
            AddLegalAndRemoveIllegalMaxItems();
        }
 public static bool PassesThrough <T>(this T value, GenericRangeFilter <T> filter) where T : IComparable
 {
     return(filter.DoesNotFilterOut(value));
 }
Ejemplo n.º 8
0
 public void _Init()
 {
     _sut = new GenericRangeFilter <int>();
 }
        public RangeFilterViewModel(GenericRangeFilter <T> genericRangeFilter, string filterName)
        {
            IsActive = genericRangeFilter.IsActive;

            FilterName = filterName;
        }
Ejemplo n.º 10
0
        public void _Init()
        {
            var rangeFilter = new GenericRangeFilter <int>().ActivateWith(MinValue, MaxValue);

            _sut = new RangeFilterForInputsViewModel <int>(rangeFilter, "someName");
        }
Ejemplo n.º 11
0
 public RangeFilterForSelectorsViewModel(
     GenericRangeFilter <T> genericRangeFilter, IEnumerable <T> availableValues, string filterName)
     : this(genericRangeFilter, availableValues, filterName, val => val.ToString())
 {
 }
Ejemplo n.º 12
0
        RangeFilterForSelectorsViewModel <int> CreateRangeFilterForSelectorsViewModelWith(int minValue, int maxValue)
        {
            var rangeFilter = new GenericRangeFilter <int>().ActivateWith(minValue, maxValue);

            return(new RangeFilterForSelectorsViewModel <int>(rangeFilter, _availableValues, "someName"));
        }
Ejemplo n.º 13
0
 public RangeFilterForInputsViewModel(GenericRangeFilter <T> genericRangeFilter, string filterName)
     : base(genericRangeFilter, filterName)
 {
     MinValue = genericRangeFilter.Range.MinValue;
     MaxValue = genericRangeFilter.Range.MaxValue;
 }