Example #1
0
        public void WrongTypeParameterAttribution()
        {
            var f = new Filter1();
            var b = new Bitmap(100, 100);

            Assert.ThrowsException <ParameterTypeException>(() => f.SetParameter("a", 1));
        }
Example #2
0
        public void WrongNameParameterAccess()
        {
            var f = new Filter1();
            var b = new Bitmap(100, 100);

            Assert.ThrowsException <ParameterNameException>(() => f.Process(b));
        }
Example #3
0
        // GET: Teachers
        public IActionResult Index(string searchIme, string searchPrezime, string searchDegree, string searchRank)
        {
            IQueryable <Teacher> teachers = _context.Teacher.AsQueryable();
            IQueryable <string>  query    = _context.Teacher.OrderBy(m => m.Degree).Select(m => m.Degree).Distinct();
            IQueryable <string>  query1   = _context.Teacher.OrderBy(m => m.AcademicRank).Select(m => m.AcademicRank).Distinct();

            if (!string.IsNullOrEmpty(searchDegree))
            {
                teachers = teachers.Where(s => s.Degree.ToLower() == searchDegree.ToLower());
            }
            if (!string.IsNullOrEmpty(searchRank))
            {
                teachers = teachers.Where(s => s.AcademicRank.ToLower() == searchRank.ToLower());
            }
            if (!string.IsNullOrEmpty(searchIme))
            {
                teachers = teachers.Where(s => s.FirstName.ToLower().Contains(searchIme.ToLower()));
            }
            if (!string.IsNullOrEmpty(searchPrezime))
            {
                teachers = teachers.Where(s => s.LastName.ToLower().Contains(searchPrezime.ToLower()));
            }

            var VM1 = new Filter1
            {
                DegreeList = new SelectList(query.AsEnumerable()),
                RankList   = new SelectList(query1.AsEnumerable()),
                Teachers   = teachers.AsEnumerable()
            };


            return(View(VM1));
        }
Example #4
0
        public override bool Match(MessageBuffer messageBuffer)
        {
            if (messageBuffer == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(messageBuffer));
            }

            return(Filter1.Match(messageBuffer) && Filter2.Match(messageBuffer));
        }
        public override string ToString()
        {
            StringBuilder filterDescription = new StringBuilder();

            switch (FilterType)
            {
            case FilterType.APPROVED_SOFTWARE_LIST:
                filterDescription.Append("software is ");
                if (IsNegated)
                {
                    filterDescription.Append("not in ");
                }
                else
                {
                    filterDescription.Append("in ");
                }
                filterDescription.Append("the list '");
                filterDescription.Append(ApprovedSoftwareListName);
                filterDescription.Append("'");
                break;

            case FilterType.LOGICAL_AND:
                if (IsNegated)
                {
                    filterDescription.Append("neither ");
                    filterDescription.Append(Filter1.ToString());
                    filterDescription.Append(" nor ");
                    filterDescription.Append(Filter2.ToString());
                }
                else
                {
                    filterDescription.Append("both ");
                    filterDescription.Append(Filter1.ToString());
                    filterDescription.Append(" and ");
                    filterDescription.Append(Filter2.ToString());
                }
                break;

            case FilterType.LOGICAL_OR:
                if (IsNegated)
                {
                    filterDescription.Append("not ");
                    filterDescription.Append(Filter1.ToString());
                    filterDescription.Append(" and not ");
                    filterDescription.Append(Filter2.ToString());
                }
                else
                {
                    filterDescription.Append("either ");
                    filterDescription.Append(Filter1.ToString());
                    filterDescription.Append(" or ");
                    filterDescription.Append(Filter2.ToString());
                }
                break;
            }
            return(filterDescription.ToString());
        }
Example #6
0
        public void Filter1Test1()
        {
            var strings = new List <string>
            {
                "Gurt",
                "Lobster",
                "Litch",
                "Doe"
            };
            var filteredStrings = Filter1.Filter(strings).ToList();

            var expected = new List <string> {
                "Litch", "Lobster"
            };

            CollectionAssert.AreEqual(expected, filteredStrings);
        }
Example #7
0
        internal bool Match(Message message, out bool addressMatched)
        {
            if (message == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(message));
            }

            if (Filter1.Match(message))
            {
                addressMatched = true;
                return(Filter2.Match(message));
            }
            else
            {
                addressMatched = false;
                return(false);
            }
        }
Example #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("IN console.  Will make the pipe class");
            APipeProcess pp  = new APipeProcess();
            MyMsg        msg = new MyMsg();

            //msg.AMessage = "I wrote a message";
            pp.msg = msg;

            Filter1 f1 = new Filter1();

            pp.Register(f1);
            Filter2 f2 = new Filter2();

            pp.Register(f2);
            Filter3 f3 = new Filter3();

            pp.Register(f3);
            pp.ExecutePipeLine();

            Console.ReadKey();
        }
        public bool isFiltered(Software item, InventoryProject projectContext)
        {
            bool result = false;

            switch (FilterType)
            {
            case FilterType.LOGICAL_AND:
                result = (Filter1.isFiltered(item, projectContext) && Filter2.isFiltered(item, projectContext));
                break;

            case FilterType.LOGICAL_OR:
                result = (Filter1.isFiltered(item, projectContext) || Filter2.isFiltered(item, projectContext));
                break;

            case FilterType.APPROVED_SOFTWARE_LIST:
                ApprovedSoftwareList           listToApply     = projectContext.getApprovedSoftwareListByName(ApprovedSoftwareListName);
                IEnumerable <ApprovedSoftware> matchingEntries =
                    from approvedSoftware in listToApply.ApprovedSoftwares
                    where approvedSoftware.SoftwareExample.SoftwareCode.Equals(item.SoftwareCode)
                    select approvedSoftware;
                foreach (ApprovedSoftware checkingEntry in matchingEntries)
                {
                    if (checkingEntry.softwareMatches(item))
                    {
                        result = true;
                        break;
                    }
                }
                break;
            }
            if (IsNegated)
            {
                result = !result;
            }
            return(result);
        }
 public bool IsDangerous() => (Filter1?.IsDangerous() ?? false) || (Filter2?.IsDangerous() ?? false);
Example #11
0
 private void checkBoxFilter1_CheckedChanged(object sender, EventArgs e)
 {
     Filter1?.Invoke();
 }
Example #12
0
        public void WrongNameParameterAttribution()
        {
            var f = new Filter1();

            Assert.ThrowsException <ParameterNameException>(() => f.SetParameter("b", 1));
        }
Example #13
0
 public override Complex GetTransmissionCoefficient(double f) => Filter1.GetTransmissionCoefficient(f) * Filter2.GetTransmissionCoefficient(f);
Example #14
0
 public override void Reset()
 {
     Filter1.Reset();
     Filter2.Reset();
 }
Example #15
0
 public override double Process(double Sample) => Filter2.Process(Filter1.Process(Sample));