Commits

Thomas Weller committed bfde6de

Various minor changes.

  • Participants
  • Parent commits cc127ac

Comments (0)

Files changed (4)

File CourseManager.Data/PersonRepository.cs

         {
             try
             {
-                var fullNames =  new List<string>(_entities.People
-                                                           .ToList() 
-                                                           .Select(@p => @p.GetFullName(nameOrdering)));
+                var fullNames =  new List<string>(
+                    _entities.People
+                             .ToList() 
+                             .Select(@p => @p.GetFullName(nameOrdering)));
                fullNames.Sort();
 
                return fullNames;

File CourseManager.Test.MsSqlServer/PersonRepositoryFixture.cs

     {
         #region Fields
 
+        private SchoolEntities _schoolContext;
         private PersonRepository _personRepository;
 
         #endregion // Fields
 
-        #region Setup/TearDown (fixture-wise)
+        #region Setup/TearDown
 
-        [FixtureSetUp]
-        public void FixtureSetUp()
+        [SetUp]
+        public void SetUp()
         {
-            _personRepository = new PersonRepository(new SchoolEntities());
+            _schoolContext = new SchoolEntities();
+            _personRepository = new PersonRepository(_schoolContext);
         }
 
         [FixtureTearDown]

File CourseManager.Test.Typemock/FakeDataHolder.cs

 
         static FakeDataHolder()
         {
-            Setup();
-        }
-
-        #endregion // Construction
-
-        #region Operations
-
-        public static void Reset()
-        {
-            PersonList.Clear();
-            PersonList.AddRange(_personData);
-
-            OfficeAssignmentList.Clear();
-            OfficeAssignmentList.AddRange(_officeAssignmentData);
-        }
-
-        public static void AddPerson(Person person)
-        {
-            PersonList.Add(person);
-        }
-
-        public static void DeletePerson(Person person)
-        {
-            if (OfficeAssignmentList.Any(@a => @a.InstructorID == person.PersonID))
-            {
-                throw new InvalidOperationException("FK_OfficeAssignment_Person");
-            }
-
-            PersonList.Remove(person);
-        }
-
-        #endregion // Operations
-
-        #region Implementation
-
-        private static void Setup()
-        {
             _personData = new List<Person>
                 {
                     new Person {PersonID = 1, FirstName = "Kim", LastName = "Abercrombie"},
                 .AsReadOnly();
         }
 
-        #endregion // Implementation
+        #endregion // Construction
+
+        #region Operations
+
+        public static void Reset()
+        {
+            PersonList.Clear();
+            PersonList.AddRange(_personData);
+
+            OfficeAssignmentList.Clear();
+            OfficeAssignmentList.AddRange(_officeAssignmentData);
+        }
+
+        public static void AddPerson(Person person)
+        {
+            PersonList.Add(person);
+        }
+
+        public static void DeletePerson(Person person)
+        {
+            if (OfficeAssignmentList.Any(@a => @a.InstructorID == person.PersonID))
+            {
+                throw new InvalidOperationException("FK_OfficeAssignment_Person");
+            }
+
+            PersonList.Remove(person);
+        }
+
+        #endregion // Operations
 
     } // class FakedataHolder
 

File CourseManager.Test.Typemock/PersonRepositoryFixture.cs

         {
             FakeDataHolder.Reset();
 
-            // 'AsQueryable()' is necessary for possible Linq Extension Methods to work...
             Isolate.WhenCalled(() => _schoolContext.People)
                     .WillReturnCollectionValuesOf(FakeDataHolder.Persons);
             Isolate.WhenCalled(() => _schoolContext.People.AddObject(null))