Exemplo n.º 1
0
        public void ApplyFilters_ApplyDateFilter_ReturnOffencesFromDate()
        {
            List <Offence> _offences = new List <Offence>
            {
                new Offence(DateTime, "", new Location(1.1, 1.1), OffenceCategories.Cybercrime),
                new Offence(DateTime.AddDays(1), "", new Location(1.1, 1.1), OffenceCategories.Drugs)
            };

            FilterList.AddFilter(new DateFilter(DateTime));
            List <Offence> filtered = _offences.FindAll(x => x.DateTime.Date.Equals(DateTime.Date));

            Assert.AreEqual(filtered, FilterList.ApplyFilters(_offences));
        }
Exemplo n.º 2
0
        public void ApplyFilters_ApplyCybercrimeAndDrugsFilter_ReturnCybercrimeAndDrugsOffences()
        {
            List <Offence> _offences = new List <Offence>
            {
                new Offence(new DateTime().ToLocalTime(), "", new Location(1.1, 1.1), OffenceCategories.Cybercrime),
                new Offence(new DateTime().ToLocalTime(), "", new Location(1.1, 1.1), OffenceCategories.Drugs),
                new Offence(new DateTime().ToLocalTime(), "", new Location(1.1, 1.1), OffenceCategories.Fraude)
            };

            FilterList.AddFilter(CategoryFilterCollection.Instance);
            CategoryFilterCollection.Instance.ToggleCategory(OffenceCategories.Cybercrime);
            CategoryFilterCollection.Instance.ToggleCategory(OffenceCategories.Drugs);
            List <Offence> filtered = _offences.FindAll(x => x.Category.Equals(OffenceCategories.Cybercrime) || x.Category.Equals(OffenceCategories.Drugs));

            Assert.AreEqual(filtered, FilterList.ApplyFilters(_offences));
        }
Exemplo n.º 3
0
        public void ApplyFilters_ApplyDateFilterAndCybercrimeFilter_ReturnCybercrimeOffencesOnRightDate()
        {
            List <Offence> _offences = new List <Offence>
            {
                new Offence(DateTime, "", new Location(1.1, 1.1), OffenceCategories.Cybercrime),
                new Offence(DateTime.AddDays(1), "", new Location(1.1, 1.1), OffenceCategories.Cybercrime),
                new Offence(DateTime, "", new Location(1.1, 1.1), OffenceCategories.Drugs)
            };

            FilterList.AddFilter(CategoryFilterCollection.Instance);
            CategoryFilterCollection.Instance.ToggleCategory(OffenceCategories.Cybercrime);
            FilterList.AddFilter(new DateFilter(DateTime));
            List <Offence> filtered = _offences.FindAll(x => x.Category.Equals(OffenceCategories.Cybercrime) && x.DateTime.Date.Equals(DateTime.Date));

            Assert.AreEqual(filtered, FilterList.ApplyFilters(_offences));
        }