Ejemplo n.º 1
0
        public void ShouldCreateNewCategory()
        {
            var newShop     = _shopService.Add(EpicShopFixture.NewShop());
            var newCategory = EpicShopFixture.NewCategory(newShop.Id);

            _categoryService.Add(newCategory);
            Assert.True(newShop.Id > 0);
        }
Ejemplo n.º 2
0
        public void ShouldFindNewShop()
        {
            var newShop = _shopService.Add(EpicShopFixture.NewShop());

            Assert.True(newShop.Id > 0);

            var findShop = _shopService.FindById(newShop.Id);

            Assert.NotNull(findShop);
        }
Ejemplo n.º 3
0
        public void ShouldUpdateNewShop()
        {
            var newShop  = _shopService.Add(EpicShopFixture.NewShop());
            var findShop = _shopService.FindById(newShop.Id);

            findShop.Description = "I updated this";

            _shopService.Update(findShop.ToViewModel <ShopInputViewModel>(), findShop.Id);

            var updated = _shopService.FindById(findShop.Id);

            Assert.Equal(updated.Description, findShop.Description);
        }
Ejemplo n.º 4
0
        public void ShouldUpdateNewCategory()
        {
            var newShop = _shopService.Add(EpicShopFixture.NewShop());

            var newCategory = _categoryService.Add(EpicShopFixture.NewCategory(newShop.Id));

            Assert.True(newCategory.Id > 0);

            CategoryModel findCategory = _categoryService.FindById(newCategory.Id);

            findCategory.Description = "abc";

            _categoryService.Update(findCategory.ToViewModel <CategoryInputViewModel>(), findCategory.Id);

            var updated = _categoryService.FindById(findCategory.Id);

            Assert.Equal(updated.Description, findCategory.Description);
        }
Ejemplo n.º 5
0
        public void ShouldDeleteNewShop()
        {
            var newShop     = _shopService.Add(EpicShopFixture.NewShop());
            var newCategory = _categoryService.Add(EpicShopFixture.NewCategory(newShop.Id));

            _categoryService.Delete(newCategory.Id);

            CategoryModel categoryModel = null;

            try
            {
                categoryModel = _categoryService.FindById(newCategory.Id);
                Assert.True(false, "The should have been deleted");
            }
            catch (EntityNotFoundExceptions)
            {
                Assert.Null(categoryModel);
            }
        }
Ejemplo n.º 6
0
        public void ShouldNotAllowForTwoSameNamesForShop()
        {
            var newShop    = EpicShopFixture.NewShop();
            var newShopTwo = EpicShopFixture.NewShop();

            newShopTwo.Name = newShop.Name;

            _shopService.Add(newShop);

            try
            {
                _shopService.Add(newShopTwo);
                Assert.True(false, "Adding a shop with the same name is not allowed");
            }
            catch (Exception)
            {
                Assert.True(true, "Adding a shop with the same name was not allowed");
            }
        }
Ejemplo n.º 7
0
        public void ShouldDeleteNewShop()
        {
            var newShop = _shopService.Add(EpicShopFixture.NewShop());

            _shopService.Update(newShop.ToViewModel <ShopInputViewModel>(), newShop.Id);
            _shopService.Delete(newShop.Id);

            ShopModel deletedShop = null;

            try
            {
                deletedShop = _shopService.FindById(newShop.Id);
                Assert.True(false, "The should should have been deleted");
            }
            catch (EntityNotFoundExceptions)
            {
                Assert.Null(deletedShop);
            }
        }
Ejemplo n.º 8
0
        public void ShouldCreateNewShop()
        {
            var newShop = _shopService.Add(EpicShopFixture.NewShop());

            Assert.True(newShop.Id > 0);
        }