コード例 #1
0
        public void CanCompareCategories() {
            Category category1 = new Category("Acme");
            Category category2 = new Category("Anvil");
            Category category3 = new Category("Acme");

            category1.ShouldNotEqual(category2);
            category1.ShouldEqual(category3);
        }
コード例 #2
0
        public void CanCreateProduct() {
            Supplier supplierOfProduct = new Supplier("Acme");
            Product product = new Product("Fruit", supplierOfProduct);

            Category categoryOfProduct = new Category("Good Stuff");
            product.Category = categoryOfProduct;

            product.ProductName.ShouldEqual("Fruit");
            product.Supplier.ShouldEqual(new Supplier("Acme"));
            product.Category.ShouldEqual(categoryOfProduct);
        }
コード例 #3
0
 private Category CreateCategory()
 {
     Category category = new Category("Hawaiian");
     EntityIdSetter.SetIdOf(category, 1);
     return category;
 }
コード例 #4
0
        public void CanCreateCategory() {
            string categoryName = "Just testing";
            Category category = new Category(categoryName);

            category.CategoryName.ShouldEqual(categoryName);
        }
コード例 #5
0
        public ActionResult Create(string categoryName) {
            Category category = new Category(categoryName);
            category = categoryRepository.SaveOrUpdate(category);

            return View(category);
        }
コード例 #6
0
 private void CreatePersistedCategory(string categoryName)
 {
     Category category = new Category(categoryName);
     categoryRepository.SaveOrUpdate(category);
     FlushSessionAndEvict(category);
 }
コード例 #7
0
 protected override void EstablishContext()
 {
     // create test data
     toDb = GetPersistedCategory("Beverages");
     GetPersistedCategory("Condiments");
     GetPersistedCategory("Seafood");
 }
コード例 #8
0
 protected override void Act()
 {
     fromDb = categoryRepository.Get(toDb.Id);
 }
コード例 #9
0
 private Category GetPersistedCategory(string categoryName)
 {
     var category = new Category(categoryName);
     categoryRepository.SaveOrUpdate(category);
     FlushSessionAndEvict(category);
     return category;
 }