Exemplo n.º 1
0
        public void TestListDashboards()
        {
            LMDashboard d = LMDashboard.DefaultTemplate(5);

            d.Name = "Dashboard1";
            storage.Store(d);

            List <Dashboard> dashboards = storage.RetrieveAll <Dashboard> ().ToList();

            Assert.AreEqual(1, dashboards.Count);
            Assert.AreEqual(d.ID, dashboards [0].ID);
            Assert.AreEqual(d.Name, dashboards [0].Name);
            Assert.IsTrue(dashboards.All(i => i.DocumentID != null));

            for (int i = 0; i < 5; i++)
            {
                var da = LMDashboard.DefaultTemplate(5);
                da.Name = "Dashboard" + (i + 2);
                storage.Store(da);
            }

            dashboards = storage.RetrieveAll <Dashboard> ().ToList();
            Assert.IsTrue(dashboards.All(i => i.DocumentID != null));
            Assert.AreEqual(6, dashboards.Count);
        }
Exemplo n.º 2
0
        public void TestMigration()
        {
            string dir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            Directory.CreateDirectory(dir);

            var assembly = Assembly.GetExecutingAssembly();

            using (Stream fs = assembly.GetManifestResourceStream("longomatch.tar.gz")) {
                using (Stream gzipStream = new GZipInputStream(fs)) {
                    using (TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream)) {
                        tarArchive.ExtractContents(dir);
                    }
                }
            }

            CouchbaseStorageLongoMatch storage = new CouchbaseStorageLongoMatch(dir, "longomatch");

            Assert.AreEqual(2, storage.RetrieveAll <Team> ().Count());
            Assert.AreEqual(1, storage.RetrieveAll <Dashboard> ().Count());
            Assert.AreEqual(1, storage.RetrieveAll <LMProject> ().Count());

            Team team = storage.RetrieveAll <Team> ().First();

            Assert.DoesNotThrow(team.Load);

            Dashboard dashboard = storage.RetrieveAll <Dashboard> ().First();

            Assert.DoesNotThrow(dashboard.Load);

            LMProject project = storage.RetrieveAll <LMProject> ().First();

            Assert.DoesNotThrow(project.Load);
        }