Пример #1
0
        public Property TripletIsPresentWhenTripletIsFound()
        {
            var chars    = Enumerable.Range('0', 10).Concat(Enumerable.Range('a', 6)).Select(c => (char)c);
            var dataGen  = Gen.Elements(chars).ArrayOf().Select(cs => new string(cs));
            var finder   = new NletFinder(3);
            var findings = dataGen.Select(data => new { data, found = finder.Find(data) }).Where(f => f.found.HasValue);

            return(Prop.ForAll(findings.ToArbitrary(),
                               finding => finding.data.Contains(string.Join("", Enumerable.Repeat(finding.found.Value, 3)))));
        }
Пример #2
0
        public void NullIsReturnedWhenNoNletIsPresent(int n, string data)
        {
            var finder = new NletFinder(n);

            Assert.Null(finder.Find(data));
        }
Пример #3
0
        public void NletIsFoundWhenPresent(int n, char?c, string data)
        {
            var finder = new NletFinder(n);

            Assert.Equal(c, finder.Find(data));
        }