-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit tests, updated model to match Swift
- Loading branch information
1 parent
2db060e
commit 412596b
Showing
20 changed files
with
883 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="BookTests.cs" company="Conglomo"> | ||
// Copyright 2020-2021 Conglomo Limited. Please see LICENSE for license details. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace GoToBible.Tests.Model | ||
{ | ||
using GoToBible.Model; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Tests the <see cref="Book"/> class. | ||
/// </summary> | ||
[TestClass] | ||
public class BookTests | ||
{ | ||
/// <summary> | ||
/// Tests the empty object. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestEmpty() | ||
{ | ||
Book book = new Book(); | ||
Assert.AreEqual(book.Name, string.Empty); | ||
Assert.AreEqual(book.Chapters.Count, 0); | ||
Assert.AreEqual(book.ToString(), string.Empty); | ||
} | ||
|
||
/// <summary> | ||
/// Tests the <see cref="Book.Name"/> property. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestName() | ||
{ | ||
Book book = new Book() | ||
{ | ||
Name = "Genesis", | ||
}; | ||
Assert.AreEqual(book.Name, "Genesis"); | ||
Assert.AreEqual(book.Chapters.Count, 0); | ||
Assert.AreEqual(book.ToString(), "Genesis"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="ChapterReferenceTests.cs" company="Conglomo"> | ||
// Copyright 2020-2021 Conglomo Limited. Please see LICENSE for license details. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace GoToBible.Tests.Model | ||
{ | ||
using GoToBible.Model; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Tests the <see cref="ChapterReference"/> class. | ||
/// </summary> | ||
[TestClass] | ||
public class ChapterReferenceTests | ||
{ | ||
/// <summary> | ||
/// Tests the empty constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestEmpty() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference(); | ||
Assert.AreEqual(chapterReference.Book, string.Empty); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 0); | ||
Assert.AreEqual(chapterReference.ToString(), string.Empty); | ||
Assert.IsFalse(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests an invalid constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestBookAndChapterInvalidConstructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference(string.Empty); | ||
Assert.AreEqual(chapterReference.Book, string.Empty); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 0); | ||
Assert.AreEqual(chapterReference.ToString(), string.Empty); | ||
Assert.IsFalse(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests an invalid chapter constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestBookAndChapterInvalidChapterConstructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference("Genesis Fifty"); | ||
Assert.AreEqual(chapterReference.Book, "Genesis"); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 0); | ||
Assert.AreEqual(chapterReference.ToString(), "Genesis 0"); | ||
Assert.IsTrue(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests a missing chapter constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestBookAndChapterMissingChapterConstructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference("Genesis"); | ||
Assert.AreEqual(chapterReference.Book, "Genesis"); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 0); | ||
Assert.AreEqual(chapterReference.ToString(), "Genesis 0"); | ||
Assert.IsTrue(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests a valid chapter constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestBookAndChapterValidChapterConstructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference("Genesis 50"); | ||
Assert.AreEqual(chapterReference.Book, "Genesis"); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 50); | ||
Assert.AreEqual(chapterReference.ToString(), "Genesis 50"); | ||
Assert.IsTrue(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests an invalid two parameter constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestTwoParameterInvalidConstructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference(string.Empty, 0); | ||
Assert.AreEqual(chapterReference.Book, string.Empty); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 0); | ||
Assert.AreEqual(chapterReference.ToString(), string.Empty); | ||
Assert.IsFalse(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests an invalid two parameter constructor for Psalm 151. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestTwoParameterPsalm151Constructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference("Psalm 151", 0); | ||
Assert.AreEqual(chapterReference.Book, "Psalm"); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 151); | ||
Assert.AreEqual(chapterReference.ToString(), "Psalm 151"); | ||
Assert.IsTrue(chapterReference.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Tests a valid two parameter constructor. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestTwoParameterValidConstructor() | ||
{ | ||
ChapterReference chapterReference = new ChapterReference("Genesis", 50); | ||
Assert.AreEqual(chapterReference.Book, "Genesis"); | ||
Assert.AreEqual(chapterReference.ChapterNumber, 50); | ||
Assert.AreEqual(chapterReference.ToString(), "Genesis 50"); | ||
Assert.IsTrue(chapterReference.IsValid); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="ChapterTests.cs" company="Conglomo"> | ||
// Copyright 2020-2021 Conglomo Limited. Please see LICENSE for license details. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace GoToBible.Tests.Model | ||
{ | ||
using GoToBible.Model; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
/// <summary> | ||
/// Tests the <see cref="Chapter"/> class. | ||
/// </summary> | ||
[TestClass] | ||
public class ChapterTests | ||
{ | ||
/// <summary> | ||
/// Tests the empty object. | ||
/// </summary> | ||
[TestMethod] | ||
public void TestEmpty() | ||
{ | ||
Chapter chapter = new Chapter(); | ||
Assert.AreEqual(chapter.Book, string.Empty); | ||
Assert.AreEqual(chapter.ChapterNumber, 0); | ||
Assert.AreEqual(chapter.Copyright, string.Empty); | ||
Assert.AreEqual(chapter.NextChapterReference.ToString(), string.Empty); | ||
Assert.AreEqual(chapter.PreviousChapterReference.ToString(), string.Empty); | ||
Assert.IsFalse(chapter.SupportsItalics); | ||
Assert.AreEqual(chapter.Text, string.Empty); | ||
Assert.AreEqual(chapter.Translation, string.Empty); | ||
} | ||
} | ||
} |
Oops, something went wrong.