예제 #1
0
        public void SetUp()
        {
            MockWikiApplication application = new MockWikiApplication(new FederationConfiguration(),
                new LinkMaker("test://FileSystemStoreTests/"), OutputFormat.HTML,
                new MockTimeProvider(TimeSpan.FromSeconds(1)));
            federation = new Federation(application);
            _fileSystem = new MockFileSystem(
                new MockDirectory(@"C:\",
                    new MockDirectory("flexwiki",
                        new MockDirectory("namespaces",
                            new MockDirectory("namespaceone",
                                new MockFile(@"TopicOne.wiki", new DateTime(2004, 10, 28), @"This is some content"),
                                new MockFile(@"TopicTwo.wiki", new DateTime(2004, 10, 29), @"This is some other content"),
                                new MockFile(@"MULTIcapsGoodTopic.wiki",
                                    new DateTime(2004, 11, 05), new DateTime(2007, 10, 22), @"", MockTopicStorePermissions.ReadOnly, true),

                                new MockFile(@"HomePage.wiki", new DateTime(2004, 10, 30), @"Home page."),
                                new MockFile(@"HomePage(2003-11-24-20-31-20-WINGROUP-davidorn).awiki",
                                    new DateTime(2004, 10, 31), @"Old home page."),

                                new MockFile(@"CodeImprovementIdeas.wiki", new DateTime(2004, 11, 10), @"Latest"),
                                new MockFile(@"CodeImprovementIdeas(2003-11-23-14-34-03-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 09), @"Latest"),
                                new MockFile(@"CodeImprovementIdeas(2003-11-23-14-34-04.8890-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 08), @"Older"),
                                new MockFile(@"CodeImprovementIdeas(2003-11-23-14-34-05.1000-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 07), @"Still older"),
                                new MockFile(@"CodeImprovementIdeas(2003-11-23-14-34-06.1-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 06), @"Even older"),
                                new MockFile(@"CodeImprovementIdeas(2003-11-23-14-34-07-Name).awiki",
                                    new DateTime(2004, 11, 05), @"Really old"),
                                new MockFile(@"CodeImprovementIdeas(2003-11-23-14-34-08.123-Name).awiki",
                                    new DateTime(2004, 11, 04), @"Oldest"),

                                new MockFile(@"TestDeleteHistory.wiki", new DateTime(2004, 11, 10), @"Latest"),
                                new MockFile(@"TestDeleteHistory(2003-11-23-14-34-03-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 09), @"Latest"),
                                new MockFile(@"TestDeleteHistory(2003-11-23-14-34-04.8890-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 08), @"Older"),
                                new MockFile(@"TestDeleteHistory(2003-11-23-14-34-05.1000-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 07), @"Still older"),
                                new MockFile(@"TestDeleteHistory(2003-11-23-14-34-06.1-127.0.0.1).awiki",
                                    new DateTime(2004, 11, 06), @"Even older"),
                                new MockFile(@"TestDeleteHistory(2003-11-23-14-34-07-Name).awiki",
                                    new DateTime(2004, 11, 05), @"Really old"),
                                new MockFile(@"TestDeleteHistory(2003-11-23-14-34-08.123-Name).awiki",
                                    new DateTime(2004, 11, 04), @"Oldest"),

                                new MockFile(@"ReadOnlyTopic.wiki",
                                    new DateTime(2004, 11, 05), @"", MockTopicStorePermissions.ReadOnly),
                                new MockFile(@"ReadOnlyTopic(2004-11-05-00-00-00-Name).awiki",
                                    new DateTime(2004, 11, 05), @""),
                                new MockFile(@"ReadOnlyTopic2.wiki",
                                    new DateTime(2004, 11, 05), new DateTime(2007, 10, 22), @"", MockTopicStorePermissions.ReadOnly, true),
                                new MockFile(@"ReadWriteTopic.wiki",
                                    new DateTime(2004, 11, 05), new DateTime(2007, 10, 22), @"", MockTopicStorePermissions.ReadWrite, false),

                                new MockFile(@"DeletedTopic(2004-11-11-00-00-00-Name).awiki",
                                    new DateTime(2004, 11, 11), @"This topic was deleted.")
                             )
                         )
                     )
                 )
             );

            federation.RegisterNamespace(new FileSystemStore(_fileSystem), "NamespaceOne",
                new NamespaceProviderParameterCollection(
                    new NamespaceProviderParameter("Root", Root)));

            // Necessary to bypass security because a non-existent manager can't be
            // retrieved directly from the federation
            manager = WikiTestUtilities.GetNamespaceManagerBypassingSecurity(federation, "NamespaceOne");

            _provider = (FileSystemStore)manager.GetProvider(typeof(FileSystemStore));

            IMockWikiApplication setApp = (IMockWikiApplication)Federation.Application;
            setApp.SetApplicationProperty("DisableNewParser", false);
            setApp.SetApplicationProperty("EnableNewParser", true);
            parser = new ParserEngine(federation);
            //Necessary to init WikiInputDocument for all WomDocument tests
            //inputDoc = parser.InitWikiDocument(Path.Combine(mockapp.WebPath, @"InputDocs/AstralisLux.wiki"));
        }
예제 #2
0
        public void RegisterNamespace()
        {
            MockWikiApplication application = new MockWikiApplication(
                new FederationConfiguration(),
                new LinkMaker("test://federationtests"),
                OutputFormat.HTML,
                new MockTimeProvider(TimeSpan.FromSeconds(1))); 

            Federation federation = new Federation(application);
            MockContentStore store = new MockContentStore();
            NamespaceManager storeManager = federation.RegisterNamespace(store, "MockStore");

            Assert.IsNotNull(storeManager, "Checking that a NamespaceManager was created.");
            Assert.AreSame(storeManager, store.NamespaceManager,
              "Checking that the MockContentStore is at the end of the content store chain.");
        }
예제 #3
0
        public void SetUp()
        {
            MockWikiApplication application = new MockWikiApplication(new FederationConfiguration(),
                new LinkMaker("test://SqlStoreTests/"), OutputFormat.HTML,
                new MockTimeProvider(TimeSpan.FromSeconds(1)));
            _federation = new Federation(application);
            _database = new MockDatabase(TestDataSets.Default());

            _federation.RegisterNamespace(new SqlStore(_database), "NamespaceOne",
                new NamespaceProviderParameterCollection(
                    new NamespaceProviderParameter("ConnectionString", _connectionString)));

            // Necessary to bypass security because a non-existent manager can't be
            // retrieved directly from the federation
            NamespaceManager manager = WikiTestUtilities.GetNamespaceManagerBypassingSecurity(_federation, "NamespaceOne");

            _provider = (SqlStore)manager.GetProvider(typeof(SqlStore));
        }
예제 #4
0
 internal static NamespaceManager CreateMockStore(Federation federation, string ns, 
     MockSetupOptions options, NamespaceProviderParameterCollection parameters)
 {
     MockContentStore store = new MockContentStore(options);
     return federation.RegisterNamespace(store, ns, parameters);
 }