Exemplo 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());
        }
Exemplo n.º 2
0
 public FakeUserProvider(NForum.Database.EntityFramework.Dbos.ForumUser fu)
 {
     this.fu = fu;
 }