comparison Library/LibrarySystem.Tests/Core/BookTests.cs @ 43:aef06698d9e2 Test

Added the library tests
author Steven Hollidge <stevenhollidge@hotmail.com>
date Wed, 04 Apr 2012 19:20:20 +0100
parents
children
comparison
equal deleted inserted replaced
42:0d4aff4f699d 43:aef06698d9e2
1 using System;
2 using LibrarySystem.Core;
3 using LibrarySystem.Interfaces;
4 using NUnit.Framework;
5
6 namespace LibrarySystem.Tests.Core
7 {
8 [TestFixture]
9 class BookTests
10 {
11 [Test]
12 public void Create_WithNullIdAndNullPublication_ShouldThrowArgumentNullException()
13 {
14 Assert.Throws<ArgumentNullException>(() => Book.Create(null, null));
15 }
16
17 [Test]
18 public void Create_WithNullIdAndValidPublication_ShouldThrowArgumentNullException()
19 {
20 var publisher = Publisher.Create("dummy");
21 var publication = Publication.Create("dummy", "dummy", publisher, "dummy");
22 Assert.Throws<ArgumentNullException>(() => Book.Create(null, publication));
23 }
24
25 [Test]
26 public void Create_WithNullPublication_ShouldThrowArgumentNullException()
27 {
28 var validId = "1";
29 Assert.Throws<ArgumentNullException>(() => Book.Create(validId, null));
30 }
31
32 [Test]
33 public void Create_WithValidParametersPublication_ShouldReturnBook()
34 {
35 var publisher = Publisher.Create("dummy");
36 var publication = Publication.Create("dummy","dummy", publisher, "dummy");
37 var validId = "1";
38 IBook book = Book.Create(validId, publication);
39 Assert.NotNull(book);
40 }
41 }
42 }