Ejemplo n.º 1
0
        public void TestCRUDForWorkouts()
        {
            var context = new cse136Context();
            var access  = new GenericAccess(context);
            var workout = access.Add(new Workouts {
                Name = "Test Workout", Category = "Unit test", CreatorId = 5
            });

            Assert.AreEqual("Test Workout", workout.Name);

            workout.Name     = "Changed Test Workout";
            workout.Category = "Changed Workout";
            workout          = access.Update(workout, workout.Id);
            var returned = access.GetById <Workouts>(workout.Id);

            Assert.AreEqual(workout.Name, returned.Name);
            access.Delete <Workouts>(returned.Id);
        }
Ejemplo n.º 2
0
        public void TestCRUDForPersons()
        {
            var context = new cse136Context();
            var access  = new GenericAccess(context);
            var person  = access.Add(new Persons {
                Age = 12, Email = "*****@*****.**", Name = "UnitTest", Password = "******", Sex = "M", Profile = "For unit test"
            });

            Assert.AreEqual("UnitTest", person.Name);

            person.Name    = "Changed UnitTest";
            person.Profile = "Changed profile";

            Persons personReturn2 = access.Update(person, person.Id);
            var     returned2     = access.GetById <Persons>(person.Id);

            Assert.AreEqual(person.Name, returned2.Name);
            access.Delete <Persons>(returned2.Id);
        }