diff Library/LibrarySystem.Tests/Core/PublicationTests.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Library/LibrarySystem.Tests/Core/PublicationTests.cs	Wed Apr 04 19:20:20 2012 +0100
@@ -0,0 +1,45 @@
+using System;
+using LibrarySystem.Core;
+using NUnit.Framework;
+
+namespace LibrarySystem.Tests.Core
+{
+    [TestFixture]
+    class PublicationTests
+    {
+        [Test]
+        public void Create_WithValidParams_ShouldReturnPublication()
+        {
+            var publisher = Publisher.Create("dummy");
+            var publication = Publication.Create("dummy","dummy", publisher, "dummy");
+            Assert.IsNotNull(publication);
+        }
+
+        [Test]
+        public void Create_WithNullAuthor_ShouldThrowAgrumentNullException()
+        {
+            var publisher = Publisher.Create("dummy");
+            Assert.Throws<ArgumentNullException>(() => Publication.Create(null, "dummy", publisher, "dummy"));
+        }
+
+        [Test]
+        public void Create_WithNullISBN_ShouldThrowAgrumentNullException()
+        {
+            var publisher = Publisher.Create("dummy");
+            Assert.Throws<ArgumentNullException>(() => Publication.Create("dummy", null, publisher, "dummy"));
+        }
+
+        [Test]
+        public void Create_WithNullPublisher_ShouldThrowAgrumentNullException()
+        {
+            Assert.Throws<ArgumentNullException>(() => Publication.Create("dummy","dummy", null, "dummy"));
+        }
+
+        [Test]
+        public void Create_WithNullTitle_ShouldThrowAgrumentNullException()
+        {
+            var publisher = Publisher.Create("dummy");
+            Assert.Throws<ArgumentNullException>(() => Publication.Create("dummy", "dummy", publisher, null));
+        }
+    }
+}