Mercurial > silverbladetech
comparison 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 |
comparison
equal
deleted
inserted
replaced
42:0d4aff4f699d | 43:aef06698d9e2 |
---|---|
1 using System.Collections.Generic; | 1 using System; |
2 using LibrarySystem.Interfaces; | 2 using LibrarySystem.Interfaces; |
3 | 3 |
4 namespace LibrarySystem.Core | 4 namespace LibrarySystem.Core |
5 { | 5 { |
6 public class Book : IBook | 6 public class Book : IBook |
8 public string Author { get; set; } | 8 public string Author { get; set; } |
9 public string ISBN { get; set; } | 9 public string ISBN { get; set; } |
10 public IPublisher Publisher { get; set; } | 10 public IPublisher Publisher { get; set; } |
11 public string Title { get; set; } | 11 public string Title { get; set; } |
12 public string Id { get; set; } | 12 public string Id { get; set; } |
13 public decimal CurrentFee { get; set; } | |
14 public IList<IRental> RentalHistory { get; set; } | |
15 | 13 |
16 public Book(IPublication publication) | 14 private Book() |
17 { | 15 { |
18 Author = publication.Author; | 16 |
19 ISBN = publication.ISBN; | 17 } |
20 Title = publication.Title; | 18 |
21 Publisher = publication.Publisher; | 19 public static IBook Create(string id, IPublication publication) |
22 RentalHistory = new List<IRental>(0); | 20 { |
21 if (id == null || publication == null) | |
22 throw new ArgumentNullException(); | |
23 | |
24 return new Book() | |
25 { | |
26 Author = publication.Author, | |
27 Id = id, | |
28 ISBN = publication.ISBN, | |
29 Title = publication.Title, | |
30 Publisher = publication.Publisher | |
31 }; | |
23 } | 32 } |
24 } | 33 } |
25 } | 34 } |