public void CategoriesShouldBeReturnedNested()
        {
            using (new TransactionScope())
            {
                var connectionStringProvider = new ConnectionStringProvider("<my connection string>");
                var dataContextProvider = new DataContextProvider(connectionStringProvider);

                // first insert a new graph into the database
                var categoryRepository = new Repository<Category>(dataContextProvider);

                // use the object graph created by the mock category repository
                var root = MockRepositoryBuilder.CreateCategoryRepository().GetRootCategory();

                // add the root into the real database
                categoryRepository.InsertOnSubmit(root);

                categoryRepository.SubmitChanges();

                // try to get the root again (note we need the actual id because we don't want the real root,
                // which will have a different graph of categories, from the database)
                var rootFromDb = categoryRepository.GetById(root.CategoryId);

                MockRepositoryBuilder.AssertCategoryGraphIsCorrect(rootFromDb);
            }
        }
 public void SetUp()
 {
     // an incorrect connection string
     var connectionStringProvider1 = 
         new ConnectionStringProvider(@"Data Source=.\SQLEXPRESS;Initial Catalog=SutekiShopX;Integrated Security=True");
     var connectionStringProvider2 = 
         new ConnectionStringProvider(@"Data Source=.\SQLEXPRESS;Initial Catalog=SomeOtherNonExistantDatabase;Integrated Security=True");
     dbConnectionChecker = new DbConnectionChecker(connectionStringProvider1, connectionStringProvider2);
 }
예제 #3
0
 private void CreateServices()
 {
     var connectionStringProvider = new ConnectionStringProvider("Data Source=.\\SQLEXPRESS;Initial Catalog=JumpTheGun;Integrated Security=True");
     var dataContextProvider = new DataContextProvider(connectionStringProvider);
     this.contentRepository = new Repository<Content>(dataContextProvider);
     this.userRepository = new Repository<User>(dataContextProvider);
     var categoryRepository = new Repository<Suteki.Shop.Category>(dataContextProvider);
     this.contentOrderableService = new OrderableService<Content>(contentRepository);
     this.baseControllerService = new BaseControllerService(categoryRepository);
     this.imageFileService = new ImageFileService();
 }