Ejemplo n.º 1
0
        public void IdFilterApply_WithValidValue_ReturnOneRecord()
        {
            var searchFilters = new SearchBinFilters
            {
                Id = new FilterType <int>
                {
                    Values = new List <int> {
                        1
                    }
                }
            };

            var result = _filter.Apply(_bins, searchFilters);

            Assert.AreEqual(1, result.Count());
        }
Ejemplo n.º 2
0
        public void NameFilterApply_WithAnySearchType_ReturnRecordThatContainsAnyFilters()
        {
            var searchFilters = new SearchBinFilters
            {
                BinName = new FilterType <string>
                {
                    SearchType = SearchType.Any,
                    Values     = new List <string> {
                        "This", "bin1"
                    }
                }
            };

            var result = _filter.Apply(_bins, searchFilters);

            Assert.AreEqual(_bins.Count(), result.Count());
        }
Ejemplo n.º 3
0
        public void Apply_WithDefaultStatus_Should_Return_All_Items()
        {
            var searchfilters = new SearchBinFilters()
            {
                Status = new FilterType <BinStatuses>()
                {
                    SearchType = SearchType.Any,
                    Values     = new List <BinStatuses>()
                    {
                        _defaultStatus
                    }
                }
            };

            var rersult = _filter.Apply(_bins, searchfilters);

            Assert.AreEqual(_bins.Count(), rersult.Count());
        }
Ejemplo n.º 4
0
        public void Apply_WithCorrectAndExistingName_Should_Return_All_Items()
        {
            var searchfilters = new SearchBinFilters()
            {
                LastModifiedBy = new FilterType <string>()
                {
                    SearchType = SearchType.Any,
                    Values     = new List <string>()
                    {
                        _modifierName
                    }
                }
            };

            var rersult = _filter.Apply(_bins, searchfilters);

            Assert.AreEqual(_bins.Count(), rersult.Count());
        }
Ejemplo n.º 5
0
        public void Apply_WithCurrentDateAndTypeSearchAll_Should_Return_One_Item()
        {
            var searchfilters = new SearchBinFilters()
            {
                LastModified = new FilterType <RangeFilterField <DateTime> >()
                {
                    SearchType = SearchType.All,
                    Values     = new List <RangeFilterField <DateTime> >()
                    {
                        new RangeFilterField <DateTime>()
                        {
                            From = DateTime.Today,
                            To   = DateTime.Today
                        },
                        new RangeFilterField <DateTime>()
                        {
                            From = DateTime.MinValue,
                            To   = DateTime.MaxValue
                        }
                    }
                }
            };

            var rersult = _filter.Apply(_bins, searchfilters);

            Assert.AreEqual(rersult.Count(), 1);
        }