view Library/LibrarySystem/Core/Book.cs @ 97:1adc1ae981ea

Tests added to SilverlightValidation.Tests
author stevenhollidge <stevenhollidge@hotmail.com>
date Sat, 05 May 2012 16:39:00 +0100
parents aef06698d9e2
children
line wrap: on
line source

using System;
using LibrarySystem.Interfaces;

namespace LibrarySystem.Core
{
    public class Book : IBook
    {
        public string Author { get; set; }
        public string ISBN { get; set; }
        public IPublisher Publisher { get; set; }
        public string Title { get; set; }
        public string Id { get; set; }

        private Book()
        {
            
        }

        public static IBook Create(string id, IPublication publication)
        {
            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
                       };
        }
    }
}