Пример #1
0
        public void TestDatabaseClusterAddRemove()
        {
            using (ODatabase database = new ODatabase(_hostname, _port, _databaseName, ODatabaseType.Document, _username, _password))
            {
                OCluster newCluster = database.AddCluster(OClusterType.Physical, "tempClusterTest001x");

                Assert.IsTrue(newCluster.ID >= 0);
                Assert.IsTrue(!string.IsNullOrEmpty(newCluster.Name));
                Assert.IsTrue(newCluster.RecordsCount == 0);

                database.Reload();

                OCluster cluster = database.Clusters.Find(x => x.ID == newCluster.ID);

                Assert.IsTrue(cluster.ID >= newCluster.ID);
                Assert.IsTrue(cluster.Name.Equals(newCluster.Name, StringComparison.CurrentCultureIgnoreCase));
                Assert.IsTrue(cluster.RecordsCount == newCluster.RecordsCount);

                database.RemoveCluster(newCluster.ID);

                OCluster cluster2 = database.Clusters.Find(x => x.ID == newCluster.ID);

                Assert.IsNull(cluster2);

                database.Reload();

                OCluster cluster3 = database.Clusters.Find(x => x.ID == newCluster.ID);

                Assert.IsNull(cluster3);
            }
        }