public void BusinessBaseFactory_Can_Create_Object()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Product product = _factory.Create();

            Assert.IsNotNull(product);
        }
        public void BusinessBaseFactory_Calls__Repository_Delete_with_Criteria()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            _factory.Delete(new SingleCriteria<Product, int>(32));

            _repository.AssertWasCalled(x => x.Load(null, null), y => y.IgnoreArguments());
            _repository.AssertWasCalled(x => x.Delete(null),y=> y.IgnoreArguments());
            unitOfWorkStub.AssertWasCalled(x => x.TransactionalFlush());
        }
        public void BusinessBaseFactory_Calls_Repository_Delete_with_Object()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Product product = Product.GetOldProduct();
            _factory.Delete(product);

            _repository.AssertWasCalled(x => x.Delete(product));
            unitOfWorkStub.AssertWasCalled(x => x.TransactionalFlush());
        }
        public void BusinessBaseFactory_Can_Save_Existing_Object()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Product product = Product.GetOldProduct();
            product.Name = "Updated Data";
            _factory.Update(product);

            _repository.AssertWasCalled(x => x.Update(product));
            unitOfWorkStub.AssertWasCalled(x => x.TransactionalFlush());
        }
 public void BusinessBaseFactory_Fetch_No_Criteria_Throws()
 {
     BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);
     Product product = _factory.Fetch();
 }
        public void BusinessBaseFactory_Can_Save_New_Object()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Product product = _factory.Create();
            product.Name = "Test 123";
            _factory.Update(product);

            _repository.AssertWasCalled(x => x.Save(product));
            unitOfWorkStub.AssertWasCalled(x => x.TransactionalFlush());
        }
        public void Can_Create_Factory()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Assert.IsNotNull(_factory);
        }
        public void BusinessBaseFactory_Fetch_WithNull_Critiria_Throws()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Product product = _factory.Create();
            product = _factory.Fetch(null);
        }
        public void BusinessBaseFactory_Fetch_WithCriteria_ReturnsObject()
        {
            BusinessBaseServerFactory<Product> _factory = new BusinessBaseServerFactory<Product>(_repository);

            Product product = _factory.Create();
            product = _factory.Fetch(new SingleCriteria<Product, int>(32));

            _repository.AssertWasCalled(x => x.Load(product, 32));
        }