Mercurial > silverbladetech
annotate Library/LibrarySystem.Tests/Core/BookTests.cs @ 64:ba89e36631bc
Latest version
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sun, 22 Apr 2012 14:20:52 +0100 |
parents | aef06698d9e2 |
children |
rev | line source |
---|---|
43
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 using System; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 using LibrarySystem.Core; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 using LibrarySystem.Interfaces; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 using NUnit.Framework; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 namespace LibrarySystem.Tests.Core |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 { |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 [TestFixture] |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 class BookTests |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 { |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 [Test] |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 public void Create_WithNullIdAndNullPublication_ShouldThrowArgumentNullException() |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 { |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 Assert.Throws<ArgumentNullException>(() => Book.Create(null, null)); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 } |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 [Test] |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 public void Create_WithNullIdAndValidPublication_ShouldThrowArgumentNullException() |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 { |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 var publisher = Publisher.Create("dummy"); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 var publication = Publication.Create("dummy", "dummy", publisher, "dummy"); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 Assert.Throws<ArgumentNullException>(() => Book.Create(null, publication)); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 } |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 [Test] |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 public void Create_WithNullPublication_ShouldThrowArgumentNullException() |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 { |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 var validId = "1"; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 Assert.Throws<ArgumentNullException>(() => Book.Create(validId, null)); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 } |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 [Test] |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 public void Create_WithValidParametersPublication_ShouldReturnBook() |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 { |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35 var publisher = Publisher.Create("dummy"); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 var publication = Publication.Create("dummy","dummy", publisher, "dummy"); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 var validId = "1"; |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 IBook book = Book.Create(validId, publication); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 Assert.NotNull(book); |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 } |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41 } |
aef06698d9e2
Added the library tests
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 } |