Ejemplo n.º 1
0
        public static void Initialize()
        {
            DbConnection connection = Effort.DbConnectionFactory.CreateTransient();

            dbContext = new NForumDbContext(connection);

            DataStore = new NForum.Database.EntityFramework.EntityFrameworkDataStore(
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Category>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Forum>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Topic>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.Reply>(dbContext),
                new GenericRepository <NForum.Database.EntityFramework.Dbos.ForumUser>(dbContext)
                );

            GenericRepository <NForum.Database.EntityFramework.Dbos.ForumUser> fuRepo = new GenericRepository <Database.EntityFramework.Dbos.ForumUser>(dbContext);

            NForum.Database.EntityFramework.Dbos.ForumUser fu = fuRepo.Create(new Database.EntityFramework.Dbos.ForumUser {
                Deleted      = false,
                EmailAddress = "*****@*****.**",
                ExternalId   = "todo",
                Fullname     = "mrfake",
                Username     = "******",
                UseFullname  = true
            });

            PermissionService = new PermissionService();
            LoggingService    = new LoggingService(new FakeLogger(), new FakeLogger());
            UserProvider      = new FakeUserProvider(fu);
            EventPublisher    = new FakeEventPublisher();

            CategoryService = new CategoryService(DataStore, PermissionService, LoggingService, UserProvider, EventPublisher);
            ForumService    = new ForumService(DataStore, PermissionService, LoggingService, UserProvider, EventPublisher);
            TopicService    = new TopicService(DataStore, PermissionService, LoggingService, UserProvider, EventPublisher);
            UIService       = new UIService(DataStore, PermissionService, LoggingService, UserProvider, new FakeSettings());
        }
Ejemplo n.º 2
0
 public GenericRepository(NForumDbContext context) : base(context)
 {
 }
Ejemplo n.º 3
0
 protected RepositoryBase(NForumDbContext context)
 {
     this.context = context;
     this.set     = this.context.Set <TEntity>();
 }
Ejemplo n.º 4
0
 public static void TearDown()
 {
     dbContext = null;
 }
Ejemplo n.º 5
0
        public static void SetUp(TestContext context)
        {
            DbConnection connection = Effort.DbConnectionFactory.CreateTransient();

            dbContext = new NForumDbContext(connection);
        }