Exemplo n.º 1
0
        public void GenerateTargetsIntoDb()
        {
            List <Target> Targets = new List <Target>();
            var           repo    = new TargetRepository();

            using (var fs = new StreamReader(File.OpenRead(@"Names.csv")))
            {
                fs.ReadLine();
                while (!fs.EndOfStream)
                {
                    string   Line   = fs.ReadLine();
                    string[] data   = Line.Split(',');
                    var      target = new Target
                    {
                        TargetId  = Guid.NewGuid(),
                        GivenName = data[18],
                        Surname   = data[0],
                        Gender    = (data[17] == "Male")? Gender.Male : Gender.Female,
                        Address   = new Address {
                            AddressLine1 = data[1], StateProvince = data[2], PostalCode = data[3]
                        },
                        Birthdate    = DateTime.ParseExact(data[9], "M/d/yyyy", CultureInfo.InvariantCulture),
                        EmailAddress = data[4],
                        Telephone    = new PhoneNumber {
                            Number = data[7]
                        }
                    };
                    repo.Add(target);
                }
            }
        }
Exemplo n.º 2
0
        public static void GivenTheseEvents(params Target[] targets)
        {
            foreach (Target evnt in targets)
            {
                // Add event to Events here.
                repo1.Add(evnt);
            }

            //context.SaveChanges();
            Assert.AreEqual(targets.Length, repo.GetCount());
        }
Exemplo n.º 3
0
        private void SmokeDaySubmit(object sender, RoutedEventArgs e)
        {
            DateTime smokeDate         = (DateTime)DayToEnter.SelectedDate;
            string   smokeTime         = TimeOfSmoke.Text;
            string   placeOfSmoke      = Place.SelectionBoxItem.ToString();
            string   AntecedantOFSmoke = Antecedent.SelectionBoxItem.ToString();

            if (smokeDate == null || smokeTime == null || placeOfSmoke == null || AntecedantOFSmoke == null)
            {
                NullValuesExist.Visibility = Visibility.Visible;
            }
            else
            {
                repo1.OrderById();
                repo1.Add(new Target(smokeDate.ToShortDateString(), smokeTime, placeOfSmoke, AntecedantOFSmoke));

                Place.SelectedValue      = null;
                Antecedent.SelectedValue = null;
                TimeOfSmoke.Text         = "";
            }
        }
Exemplo n.º 4
0
        public void TestDeleteFromDatabase()
        {
            var tester = new Target("seven", "two", "three", "four");

            repo.Add(tester);
            repo.Delete(tester);
            Assert.AreEqual(0, repo.GetCount());
        }