Example #1
0
        public void ValidatesPassports_InvalidAndValidPassports_ReturnsCorrectNumbers()
        {
            //getting lazy here, this problem is kind of dumb
            var getsPassportsFromFile = new GetsPassportsFromFile();
            var invalidPassports      = getsPassportsFromFile.Get(invalidValues);
            var validPassports        = getsPassportsFromFile.Get(validValues);
            var subject = new ValidatesPassports();

            subject.Validate(invalidPassports).Count.Should().Be(0);
            subject.Validate(validPassports).Count.Should().Be(4);
        }
Example #2
0
        public void ValidatesPassports_RealFile_RejectsOnlyBadPassports()
        {
            var getsPassportsFromFile = new GetsPassportsFromFile();
            var passports             = getsPassportsFromFile.Get(realFile);
            var subject = new ValidatesPassports();

            var validatedFields = subject.Validate(passports);
            var csvWriter       = new WritesCsv();

            //csvWriter.Write(validatedFields);
            validatedFields.Count.Should().Be(156);
        }
Example #3
0
        public void ValidatesPassports_TestFile_RejectsOnlyBadPassports()
        {
            var getsPassportsFromFile = new GetsPassportsFromFile();
            var passports             = getsPassportsFromFile.Get(testFile);
            var subject = new ValidatesPassports();

            var validatedFields = subject.Validate(passports);

            validatedFields.Should().Contain(p => p.ContainsField("pid", "860033327"));
            validatedFields.Should().NotContain(p => p.ContainsField("pid", "028048884"));
            validatedFields.Should().Contain(p => p.ContainsField("pid", "760753108"));
            validatedFields.Should().NotContain(p => p.ContainsField("pid", "166559648"));
        }
Example #4
0
        public void IsValidHeight_162in_ReturnsFalse() //bugfix
        {
            var subject = new ValidatesPassports();

            subject.IsValidHeight("162in").Should().BeFalse();
        }