Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
 private Category CreateCategory()
 {
     Category category = new Category("Hawaiian");
     EntityIdSetter.SetIdOf(category, 1);
     return category;
 }
Exemplo n.º 4
0
        public void CanCreateCategory() {
            string categoryName = "Just testing";
            Category category = new Category(categoryName);

            category.CategoryName.ShouldEqual(categoryName);
        }
        public ActionResult Create(string categoryName) {
            Category category = new Category(categoryName);
            category = categoryRepository.SaveOrUpdate(category);

            return View(category);
        }
 private void CreatePersistedCategory(string categoryName)
 {
     Category category = new Category(categoryName);
     categoryRepository.SaveOrUpdate(category);
     FlushSessionAndEvict(category);
 }
 protected override void EstablishContext()
 {
     // create test data
     toDb = GetPersistedCategory("Beverages");
     GetPersistedCategory("Condiments");
     GetPersistedCategory("Seafood");
 }
 protected override void Act()
 {
     fromDb = categoryRepository.Get(toDb.Id);
 }
 private Category GetPersistedCategory(string categoryName)
 {
     var category = new Category(categoryName);
     categoryRepository.SaveOrUpdate(category);
     FlushSessionAndEvict(category);
     return category;
 }