diff Library/LibrarySystem/Core/Book.cs @ 43:aef06698d9e2 Test

Added the library tests
author Steven Hollidge <stevenhollidge@hotmail.com>
date Wed, 04 Apr 2012 19:20:20 +0100
parents dbd242eb9c33
children
line wrap: on
line diff
--- a/Library/LibrarySystem/Core/Book.cs	Tue Apr 03 23:32:40 2012 +0100
+++ b/Library/LibrarySystem/Core/Book.cs	Wed Apr 04 19:20:20 2012 +0100
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System;
 using LibrarySystem.Interfaces;
 
 namespace LibrarySystem.Core
@@ -10,16 +10,25 @@
         public IPublisher Publisher { get; set; }
         public string Title { get; set; }
         public string Id { get; set; }
-        public decimal CurrentFee { get; set; }
-        public IList<IRental> RentalHistory { get; set; }
 
-        public Book(IPublication publication)
+        private Book()
+        {
+            
+        }
+
+        public static IBook Create(string id, IPublication publication)
         {
-            Author = publication.Author;
-            ISBN = publication.ISBN;
-            Title = publication.Title;
-            Publisher = publication.Publisher;
-            RentalHistory = new List<IRental>(0);
+            if (id == null || publication == null)
+                throw new ArgumentNullException();
+
+            return new Book()
+                       {
+                           Author = publication.Author,
+                           Id = id,
+                           ISBN = publication.ISBN,
+                           Title = publication.Title,
+                           Publisher = publication.Publisher
+                       };
         }
     }
 }