public void SeedFromLiteralSeedsDatabase()
        {
            var manager = new MongoDbManager
            {
                Description = new DbDescription
                {
                    ConnectionInfo = GlobalTest.DbManager1.Description.ConnectionInfo,
                    Schemas        = new List <DbScript> {
                        new DbScript {
                            ScriptType = ScriptType.Literal, ScriptValue = LiteralSchema
                        }
                    },
                    Seeds = new List <DbScript> {
                        new DbScript {
                            ScriptType = ScriptType.Literal, ScriptValue = LiteralSeed
                        }
                    }
                }
            };

            manager.Create();
            manager.Seed();

            var db = manager.CreateDatabase();

            Assert.That(db["c1"].Count(), Is.EqualTo(2));
            Assert.That(db["c2"].Count(), Is.EqualTo(1));
        }
    public void CreateWithLiteralSchemaCreatesSchema()
    {
      var manager = new MongoDbManager
                      {
                        Description = new DbDescription
                                        {
                                          ConnectionInfo = GlobalTest.DbManager1.Description.ConnectionInfo,
                                          Schemas = new List<DbScript> {new DbScript {ScriptType = ScriptType.Literal, ScriptValue = LiteralSchema}}
                                        }
                      };

      manager.Create();

      var db = manager.CreateDatabase();

      var result = db.GetCollectionNames().FirstOrDefault(c => c == "c1");
      Assert.IsNotNull(result);
    }
    public void SeedFromLiteralSeedsDatabase()
    {
      var manager = new MongoDbManager
                    {
                      Description = new DbDescription
                                    {
                                      ConnectionInfo = GlobalTest.DbManager1.Description.ConnectionInfo,
                                      Schemas = new List<DbScript> {new DbScript {ScriptType = ScriptType.Literal, ScriptValue = LiteralSchema}},
                                      Seeds = new List<DbScript> {new DbScript {ScriptType = ScriptType.Literal, ScriptValue = LiteralSeed}}
                                    }
                    };

      manager.Create();
      manager.Seed();

      var db = manager.CreateDatabase();

      Assert.That(db["c1"].Count(), Is.EqualTo(2));
      Assert.That(db["c2"].Count(), Is.EqualTo(1));
    }
예제 #4
0
        public void CreateWithLiteralSchemaCreatesSchema()
        {
            var manager = new MongoDbManager
            {
                Description = new DbDescription
                {
                    ConnectionInfo = GlobalTest.DbManager1.Description.ConnectionInfo,
                    Schemas        = new List <DbScript> {
                        new DbScript {
                            ScriptType = ScriptType.Literal, ScriptValue = LiteralSchema
                        }
                    }
                }
            };

            manager.Create();

            var db = manager.CreateDatabase();

            var result = db.GetCollectionNames().FirstOrDefault(c => c == "c1");

            Assert.IsNotNull(result);
        }