public void create_new_book_from_factory_datepublished_defaults_to_min_date() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); Assert.AreEqual(0, book.Year); Assert.AreEqual(0, book.Month); }
public void create_new_collectable_from_interface_type_string_throws_exception() { string validTypeName = "ICollectableBase"; ICollectableBase newItem = CollectableBaseFactory.CreateCollectableBase(validTypeName); Assert.IsFalse(true, "Expected test to fail if passed an interface type name"); }
public void book_year_can_be_set_to_zero_successfully() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); book.Year = 0; Assert.AreEqual(0, book.Year); }
public void create_new_collectable_from_empty_string_throws_exception() { string invalidTypeName = ""; ICollectableBase newItem = CollectableBaseFactory.CreateCollectableBase(invalidTypeName); Assert.IsFalse(true, "Expected test to fail if passed a null type"); }
public void create_new_book_from_factory_getitems_defaults_to_zero_items_in_list() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); IList <ICollectableItem> bookItems = book.ItemInstances; Assert.AreEqual(0, bookItems.Count); }
public void create_new_factory_instance_from_valid_collectable_base_name_case_insensitive_succeeds() { string validTypeName = "BOOkBaSe"; // implements ICollectableBase ICollectableBase newItem = CollectableBaseFactory.CreateCollectableBase(validTypeName); Assert.AreEqual(validTypeName.ToUpper(), newItem.CollectableType.Name.ToUpper(), "Expected to get instance of a book base type"); }
public void create_new_collectable_from_null_type_throws_exception() { Type invalidType = null; ICollectableBase newItem = CollectableBaseFactory.CreateCollectableBase(invalidType); Assert.IsFalse(true, "Expected test to fail if passed a null type"); }
public void create_new_stamp_from_factory_isPostageStamp_defaults_to_true() { Type stampType = CollectableBaseFactory.StampType; StampBase newStamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(stampType); Assert.IsTrue(newStamp.IsPostageStamp); }
public void create_new_stamp_from_factory_country_set_to_country_default() { Type stampType = CollectableBaseFactory.StampType; StampBase newStamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(stampType); Assert.IsTrue(newStamp.Country == StampBase.COUNTRY_DEFAULT); }
public void create_new_stamp_from_factory_returns_stampbase_type() { Type stampType = CollectableBaseFactory.StampType; ICollectableBase newStamp = CollectableBaseFactory.CreateCollectableBase(stampType); Assert.IsTrue(stampType == newStamp.CollectableType); }
public void create_new_collectable_from_interface_type_throws_exception() { Type invalidType = typeof(IStampBase); ICollectableBase newItem = CollectableBaseFactory.CreateCollectableBase(invalidType); Assert.IsFalse(true, "Expected test to fail if passed an interface instead of valid collectable base type"); }
public void display_name_cannot_be_set_to_blank_string() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); book.DisplayName = ""; Assert.IsFalse(true, "Expected an exception to be thrown if a blank display name is set"); }
public void display_name_initialized_to_default_value() { string expectedValue = BookBase.DISPLAYNAME_DEFAULT; BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); Assert.AreEqual(expectedValue, book.DisplayName); }
public void iswatermarked_initialized_to_default_value() { bool expectedValue = false; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); Assert.AreEqual(expectedValue, stamp.IsWatermarked); }
public void country_name_initialized_to_default_value() { string expectedValue = StampBase.COUNTRY_DEFAULT; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); Assert.AreEqual(expectedValue, stamp.Country); }
public void ispostagestamp_initialized_to_default_value() { bool expectedValue = true; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); Assert.AreEqual(expectedValue, stamp.IsPostageStamp); }
public void display_name_initialized_to_default_value() { string expectedValue = StampBase.DISPLAYNAME_DEFAULT; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); Assert.AreEqual(expectedValue, stamp.DisplayName); }
public void book_year_cannot_be_set_to_negative() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); book.Year = -100; Assert.IsFalse(true, "Expected an exception to be thrown if a negative year is set"); }
public void create_new_book_from_factory_getitems_does_not_return_null_list() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); IList <ICollectableItem> bookItems = book.ItemInstances; Assert.IsNotNull(bookItems); }
public void issueyearend_set_to_negative_throws_exception() { int invalidEnd = -5; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); stamp.IssueYearEnd = invalidEnd; Assert.Fail("Expected exception to be thrown when passed a negative issue year end"); }
public void issueyearstart_set_to_nonnegative_succeeds() { int validStart = 2005; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); stamp.IssueYearStart = validStart; Assert.AreEqual(validStart, stamp.IssueYearStart); }
public void setting_displayname_to_valid_name_successful() { string displayName = "Display Name"; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); stamp.DisplayName = displayName; Assert.AreEqual(displayName, stamp.DisplayName); }
public void setting_displayname_to_empty_string_throws_exception() { string invalidDisplayName = ""; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); stamp.DisplayName = invalidDisplayName; Assert.Fail("Expected exception to be thrown when passed a null display name"); }
public void issueyearend_set_to_nonnegative_succeeds() { int validEnd = 2005; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); stamp.IssueYearEnd = validEnd; Assert.AreEqual(validEnd, stamp.IssueYearEnd); }
public void create_new_factory_instance_from_valid_collectable_base_succeeds() { foreach (Type validType in CollectableBaseFactory.CollectableTypes) { ICollectableBase newCollectable = CollectableBaseFactory.CreateCollectableBase(validType); Assert.AreEqual(validType, newCollectable.CollectableType, $"Expected to get instance of a {validType.Name} base type"); } }
public void compare_stamp_base_instances_by_explicitly_by_scottnumber_returns_false_when_null() { StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); StampBase testStamp = null; bool isEqual = stamp.IsSame(testStamp, false); Assert.IsFalse(isEqual, "Expected test to throw exception when comparing a null base instance"); }
public void book_year_can_be_set_to_valid_year_successfully() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); int testYear = 2015; book.Year = testYear; Assert.AreEqual(testYear, book.Year); }
public void compare_book_base_instances_by_explicit_scottnumber_returns_false_when_null() { BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); BookBase testbook = null; bool isEqual = book.IsSame(testbook, false); Assert.IsFalse(isEqual, "Expected test to throw exception when comparing a null base instance"); }
public void display_name_set_to_nonblank_value_succeeds() { string expectedValue = "Display Name"; BookBase book = (BookBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.BookType); book.DisplayName = expectedValue; Assert.AreEqual(expectedValue, book.DisplayName); }
public void firstdayofissue_sets_is_set_to_date_part_only_when_passed_date_only() { DateTime firstDateOnly = DateTime.Today; StampBase stamp = (StampBase)CollectableBaseFactory.CreateCollectableBase(CollectableBaseFactory.StampType); stamp.FirstDayOfIssue = firstDateOnly; Assert.AreEqual(firstDateOnly, stamp.FirstDayOfIssue); }