diff Library/LibrarySystem/Core/Publication.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/Publication.cs	Tue Apr 03 23:32:40 2012 +0100
+++ b/Library/LibrarySystem/Core/Publication.cs	Wed Apr 04 19:20:20 2012 +0100
@@ -1,13 +1,33 @@
-using LibrarySystem.Interfaces;
+using System;
+using LibrarySystem.Interfaces;
 
 namespace LibrarySystem.Core
 {
     public class Publication : IPublication
     {
-        public string Author { get; set; }
-        public string ISBN { get; set; }
-        public IPublisher Publisher { get; set; }
-        public string Title { get; set; }
+        public string Author { get; private set; }
+        public string ISBN { get; private set; }
+        public IPublisher Publisher { get; private set; }
+        public string Title { get; private set; }
+
+        private Publication()
+        {
+            
+        }
+
+        public static IPublication Create(string author, string isbn, IPublisher publisher, string title)
+        {
+            if (author == null || isbn == null || publisher == null || title == null)
+                throw new ArgumentNullException();
+
+            return new Publication()
+                       {
+                           Author = author,
+                           ISBN = isbn,
+                           Publisher = publisher,
+                           Title = title
+                       };
+        }
     }
 
 }