コード例 #1
0
 public static void Update(Person person)
 {
     PersonMapper.Update(person);
 }
コード例 #2
0
        public void t_Person_Save_Update()
        {
            Person_ado personAdo = null;

            // backdoor data setup
            DbTestHelper.LoadAdoObjects(delegate(IbaUnitTestEntities iba)
            {
                personAdo = Person_ado.CreatePerson_ado(TestHelper.TestGuid1, "First Name", "Last Name", 0, 0, true, true);
                personAdo.EmailAddress   = "asdf@adfasd";
                personAdo.PhoneNumber    = "(651) 646-8007";
                personAdo.Address1       = "address1";
                personAdo.Address2       = "asddress 2";
                personAdo.City           = "city";
                personAdo.Country        = "cou    ";
                personAdo.HasBeenTrained = true;
                personAdo.HasClipboard   = true;
                personAdo.OpenId         = "httP;//www.googl.ecom/asdf.adsfae";
                personAdo.PersonRole     = 1;
                personAdo.PersonStatus   = 2;
                personAdo.State          = "TX";
                personAdo.ZipCode        = "55555";

                iba.AddToPerson_ado(personAdo);
            });
            List <Person_ado> extraList = DbTestHelper.LoadExtraneousPersons();

            // Setup object to be saved. Change everything except the Id.
            Person Person = new Person()
            {
                Id             = TestHelper.TestGuid1,
                FirstName      = "First Name 2",
                LastName       = "Last Nam 2e",
                EmailAddress   = "asdf@adfasd 2",
                PhoneNumber    = "(651) 646-8888",
                Address1       = "address1",
                Address2       = "asddress 2",
                City           = "city",
                Country        = "cou    ",
                HasBeenTrained = true,
                HasClipboard   = true,
                OpenId         = "httP;//www.googl.ecom/asdf.adsfae",
                PersonRole     = Role.Administrator,
                PersonStatus   = Status.Active,
                State          = "TX",
                ZipCode        = "55555"
            };

            // Execute the test
            PersonMapper.Update(Person);

            // Validate results
            using (IbaUnitTestEntities iba = new IbaUnitTestEntities())
            {
                var PersonQuery = from Persons in iba.Person_ado select Persons;
                Assert.IsNotNull(PersonQuery, "Query result is null");
                Assert.AreEqual(extraList.Count() + 1, PersonQuery.Count(), "Wrong number of results in query");
                Person_ado adoPerson = PersonQuery.First(x => x.PersonId == TestHelper.TestGuid1);
                validateObjectEquality(Person, adoPerson);

                validateExtrapersonAdos(extraList, PersonQuery);
            }
        }