public void ValidCrimes()
        {
            var criminal = personSeeder.GetRandomPersonSeed <Criminal>();

            criminal.Crimes.Add(new CrimeCriminal());
            Assert.True(validator.Validate(criminal));
        }
Example #2
0
        public void ValidCrimes()
        {
            var victim = personSeeder.GetRandomPersonSeed <Victim>();

            victim.Crimes.Add(new CrimeVictim());
            Assert.True(validator.Validate(victim));
        }
Example #3
0
        public void ValidHeight(float value)
        {
            var criminal = personSeeder.GetRandomPersonSeed <Criminal>();

            criminal.Crimes.Add(new CrimeCriminal());
            criminal.Height = value;
            Assert.True(validator.Validate(criminal));
        }
Example #4
0
        public void ValidGender(string input)
        {
            var criminal = personSeeder.GetRandomPersonSeed <Criminal>();

            criminal.Crimes.Add(new CrimeCriminal());
            criminal.Gender = input;
            Assert.True(validator.Validate(criminal));
        }
Example #5
0
        public void ValidName(string input)
        {
            Criminal criminal = personSeeder.GetRandomPersonSeed <Criminal>();

            criminal.Crimes.Add(new CrimeCriminal());
            criminal.FirstName = input;
            Assert.True(validator.Validate(criminal));
        }
Example #6
0
        public void ValidPhoto(string input)
        {
            var len      = input.Length;
            var criminal = personSeeder.GetRandomPersonSeed <Criminal>();

            criminal.Crimes.Add(new CrimeCriminal());
            criminal.Photo = input;
            Assert.True(validator.Validate(criminal));
        }
Example #7
0
 public void SeedDatabase(int records = 10)
 {
     for (int i = 0; i < records; i++)
     {
         Console.Clear();
         Console.WriteLine("Seeding database: {0}/{1}", i + 1, records);
         using (var unitOfWork = new UnitOfWork(new CriminalContext()))
         {
             Crime crime          = _crimeSeeder.GetRandomCrimeSeed();
             int   criminalAmount = _randomGenerator.GetRandomInt(1, 5);
             for (int ca = 0; ca < criminalAmount; ca++)
             {
                 Criminal criminal = _personSeeder.GetRandomPersonSeed <Criminal>();
                 criminal.Description = "Random Description";
                 //Adding to fields
                 CrimeCriminal crimeCriminal = new CrimeCriminal();
                 crimeCriminal.Criminal = criminal;
                 crimeCriminal.Crime    = crime;
                 criminal.Crimes.Add(crimeCriminal);
                 crime.CrimeCriminals.Add(crimeCriminal);
                 //Adding to databses
                 unitOfWork.Repository <Criminal>().Add(criminal);
                 unitOfWork.Repository <CrimeCriminal>().Add(crimeCriminal);
             }
             int victimAmount = _randomGenerator.GetRandomInt(1, 5);
             for (int va = 0; va < victimAmount; va++)
             {
                 Victim victim = _personSeeder.GetRandomPersonSeed <Victim>();
                 //Adding to fields
                 CrimeVictim crimeVictim = new CrimeVictim();
                 crimeVictim.Victim = victim;
                 crimeVictim.Crime  = crime;
                 victim.Crimes.Add(crimeVictim);
                 crime.CrimeVictims.Add(crimeVictim);
                 //Adding to databse
                 unitOfWork.Repository <Victim>().Add(victim);
                 unitOfWork.Repository <CrimeVictim>().Add(crimeVictim);
             }
             unitOfWork.Complete();
         }
     }
 }