public static CategoryAreaType New(CategoryType categoryType) { // Need to create a spoof area type id that will never be a genuine area type ID int spoofAreaTypeID = categoryType.Id + IdAddition; return new CategoryAreaType { Id = spoofAreaTypeID, Name = categoryType.ShortName, ShortName = categoryType.ShortName }; }
public void TestCategoriesAreOrderedByCategoryId() { var type = new CategoryType(); var mockSessionImplementor = new Moq.Mock<ISessionImplementor>(); var set = new HashSet<Category>(new List<Category> { new Category {Id = 3}, new Category {Id = 1}, new Category {Id = 2} }); type.CategoriesFromDatabase = new PersistentGenericSet<Category>(mockSessionImplementor.Object, set); var categories = type.Categories; Assert.AreEqual(1, categories[0].Id); Assert.AreEqual(2, categories[1].Id); Assert.AreEqual(3, categories[2].Id); }