Ejemplo n.º 1
0
        public void GetsPassportsFromFle_TestFile_FirstPassportHas8Keys()
        {
            var             subject = new GetsPassportsFromFile();
            List <Passport> result  = subject.Get(testFile);

            result[0].GetFields().Count.Should().Be(8);
        }
Ejemplo n.º 2
0
        public void GetsPassportsFromFile_TestFile_Gets4Passports()
        {
            var             subject = new GetsPassportsFromFile();
            List <Passport> result  = subject.Get(testFile);

            result.Count.Should().Be(4);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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"));
        }