Esempio n. 1
0
        public void ThatBrandCanBeFoundWhenCreated()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.AreEqual(brand,
                            BrandServices.Brands.Single(b => b.Name == brand.Name));
        }
Esempio n. 2
0
        public void ThatBrandCanBeDeleted()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.AreEqual(brand,
                            BrandServices.Brands.Single(b => b.Name == brand.Name));
            BrandServices.Delete(brand);
            brand = BrandServices.Brands.FirstOrDefault(b => b.Name == BrandTestFixtures.GetDto().Name);
            Assert.IsNull(brand);
        }
Esempio n. 3
0
        public void ThatBrandCanBeUpdated()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            BrandServices.ChangeBrandName(brand, "changedName");
            Context.CurrentSession().Transaction.Commit();

            Context.CurrentSession().Transaction.Begin();
            brand = BrandServices.Brands.FirstOrDefault(b => b.Name == BrandTestFixtures.GetDto().Name);
            Assert.IsNull(brand);
        }
        public void ThatVersionDoesNotChangedAfterOnlyAReadAction()
        {
            var services = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.AreEqual(1, services.Version);
            Context.CurrentSession().Transaction.Commit();
            Context.CurrentSession().Transaction.Begin();
            var brand = BrandServices.Brands.Single(x => x.Name == BrandTestFixtures.GetDto().Name);

            Assert.AreEqual(1, brand.Version);
        }
Esempio n. 5
0
        public void ThatBrandCanBeFoundByName()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.AreEqual(brand, BrandServices.GetByName(brand.Name));
        }
Esempio n. 6
0
        public void ThatBrandHasAnId()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.IsTrue(brand.Id != Guid.Empty);
        }
Esempio n. 7
0
        public void ThatABrandCanBeGet()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.IsNotNull(brand);
        }
Esempio n. 8
0
        public void ThatBrandWithNoProductsHasEmptyProductList()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

            Assert.AreEqual(0, brand.Products.Count());
        }