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

            Assert.AreEqual(brand,
                            BrandServices.Brands.Single(b => b.Name == brand.Name));
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public void ThatBrandCanBeFoundByName()
        {
            var brand = BrandServices.WithDto(BrandTestFixtures.GetDto()).Get();

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

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

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

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