private static bool OneTimeSetup() { __collection = LegacyTestConfiguration.GetCollection <C>(); __collection.Drop(); __collection.Insert(new C { E = null }); __collection.Insert(new C { E = E.A }); __collection.Insert(new C { E = E.B }); __collection.Insert(new C { X = null }); __collection.Insert(new C { X = 1 }); __collection.Insert(new C { X = 2 }); return(true); }
public void TestFixtureSetup() { _server = Configuration.TestServer; _database = Configuration.TestDatabase; _collection = Configuration.TestCollection; _collection.Drop(); }
public void TestFixtureSetup() { _server = MongoServer.Create("mongodb://localhost/?safe=true"); _database = _server["onlinetests"]; _collection = _database.GetCollection<GDA>("testcollection"); _collection.Drop(); }
public void TestQueryAgainstInheritedField() { _collection.Drop(); _collection.Insert(new D { X = 1, Y = 2 }); var query = from d in _collection.AsQueryable <D>() where d.X == 1 select d; var translatedQuery = MongoQueryTranslator.Translate(query); Assert.IsInstanceOf <SelectQuery>(translatedQuery); Assert.AreSame(_collection, translatedQuery.Collection); Assert.AreSame(typeof(D), translatedQuery.DocumentType); var selectQuery = (SelectQuery)translatedQuery; Assert.AreEqual("(D d) => (d.X == 1)", ExpressionFormatter.ToString(selectQuery.Where)); Assert.IsNull(selectQuery.OrderBy); Assert.IsNull(selectQuery.Projection); Assert.IsNull(selectQuery.Skip); Assert.IsNull(selectQuery.Take); Assert.AreEqual("{ \"X\" : 1 }", selectQuery.BuildQuery().ToJson()); Assert.AreEqual(1, query.ToList().Count); }
public void TestFixtureSetup() { _database = Configuration.TestDatabase; var collectionSettings = new MongoCollectionSettings() { GuidRepresentation = GuidRepresentation.Standard }; _collection = _database.GetCollection<C>("csharp714", collectionSettings); _collection.Drop(); }
public void TestSaveC() { _collection.Drop(); var doc = new C { Id = ObjectId.GenerateNewId().ToString(), X = 1 }; _collection.Insert(doc); var id = doc.Id; Assert.AreEqual(1, _collection.Count()); var fetched = _collection.FindOne(); Assert.AreEqual(id, fetched.Id); Assert.AreEqual(1, fetched.X); doc.X = 2; _collection.Save(doc); Assert.AreEqual(1, _collection.Count()); fetched = _collection.FindOne(); Assert.AreEqual(id, fetched.Id); Assert.AreEqual(2, fetched.X); }
public void TestFixtureSetup() { server = MongoServer.Create("mongodb://localhost/?safe=true"); database = server["onlinetests"]; collection = database.GetCollection <GDA>("testcollection"); collection.Drop(); }
public void Test() { RequireServer.Check().ClusterTypes(ClusterType.Standalone, ClusterType.ReplicaSet).StorageEngine("mmapv1"); // make sure collection exists and has exactly one document _collection.Drop(); _collection.Insert(new BsonDocument()); var result = _collection.GetStats(); Assert.True(result.Ok); Assert.Equal(_collection.FullName, result.Namespace); Assert.Equal(1, result.ObjectCount); Assert.True(result.AverageObjectSize > 0.0); Assert.True(result.DataSize > 0); Assert.True(result.ExtentCount > 0); Assert.True(result.IndexCount > 0); Assert.True(result.IndexSizes["_id_"] > 0); Assert.True(result.IndexSizes.ContainsKey("_id_")); Assert.True(result.IndexSizes.Count > 0); Assert.True(result.IndexSizes.Keys.Contains("_id_")); Assert.True(result.IndexSizes.Values.Count() > 0); Assert.True(result.IndexSizes.Values.First() > 0); Assert.False(result.IsCapped); Assert.True(result.LastExtentSize > 0); Assert.False(result.Response.Contains("max")); Assert.Equal(_collection.FullName, result.Namespace); Assert.Equal(1, result.ObjectCount); Assert.True(result.PaddingFactor > 0.0); Assert.True(result.StorageSize > 0); Assert.Equal(CollectionSystemFlags.HasIdIndex, result.SystemFlags); Assert.True(result.TotalIndexSize > 0); Assert.Equal(CollectionUserFlags.UsePowerOf2Sizes, result.UserFlags); }
public void Test() { // make sure collection exists and has exactly one document _collection.Drop(); _collection.Insert(new BsonDocument()); var result = _collection.GetStats(); Assert.IsTrue(result.Ok); Assert.AreEqual(_collection.FullName, result.Namespace); Assert.AreEqual(1, result.ObjectCount); Assert.IsTrue(result.AverageObjectSize > 0.0); Assert.IsTrue(result.DataSize > 0); Assert.IsTrue(result.ExtentCount > 0); #pragma warning disable 618 Assert.AreEqual(1, result.Flags); #pragma warning restore Assert.IsTrue(result.IndexCount > 0); Assert.IsTrue(result.IndexSizes["_id_"] > 0); Assert.IsTrue(result.IndexSizes.ContainsKey("_id_")); Assert.IsTrue(result.IndexSizes.Count > 0); Assert.IsTrue(result.IndexSizes.Keys.Contains("_id_")); Assert.IsTrue(result.IndexSizes.Values.Count() > 0); Assert.IsTrue(result.IndexSizes.Values.First() > 0); Assert.IsFalse(result.IsCapped); Assert.IsTrue(result.LastExtentSize > 0); Assert.IsFalse(result.Response.Contains("max")); Assert.AreEqual(_collection.FullName, result.Namespace); Assert.AreEqual(1, result.ObjectCount); Assert.IsTrue(result.PaddingFactor > 0.0); Assert.IsTrue(result.StorageSize > 0); Assert.AreEqual(CollectionSystemFlags.HasIdIndex, result.SystemFlags); Assert.IsTrue(result.TotalIndexSize > 0); Assert.AreEqual(CollectionUserFlags.None, result.UserFlags); }
public void Setup() { _collection = Configuration.GetTestCollection <B>(); _collection.Drop(); _collection.CreateIndex("Value", "SubValues.Value"); //numeric _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = (byte)1, SubValues = new List <C>() { new C(2f), new C(3), new C(4D), new C(5UL) } }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = 2f, SubValues = new List <C>() { new C(6f), new C(7), new C(8D), new C(9UL) } }); //strings _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = "1", SubValues = new List <C>() { new C("2"), new C("3"), new C("4"), new C("5") } }); }
public void TestFixtureSetup() { _server = Configuration.TestServer; _database = Configuration.TestDatabase; _collection = Configuration.GetTestCollection <GDA>(); _collection.Drop(); }
public void TestCreateIndexAfterDropCollection() { if (_collection.Exists()) { _collection.Drop(); } Assert.IsFalse(_collection.IndexExists("x")); _collection.CreateIndex("x"); Assert.IsTrue(_collection.IndexExists("x")); _collection.Drop(); Assert.IsFalse(_collection.IndexExists("x")); _collection.CreateIndex("x"); Assert.IsTrue(_collection.IndexExists("x")); }
public void Setup() { _server = Configuration.TestServer; _database = Configuration.TestDatabase; _collection = Configuration.GetTestCollection <C>(); _collection.Drop(); _collection.Insert(new C { E = null }); _collection.Insert(new C { E = E.A }); _collection.Insert(new C { E = E.B }); _collection.Insert(new C { X = null }); _collection.Insert(new C { X = 1 }); _collection.Insert(new C { X = 2 }); }
public CSharp714Tests() { _database = LegacyTestConfiguration.Database; var collectionSettings = new MongoCollectionSettings() { GuidRepresentation = GuidRepresentation.Standard }; _collection = _database.GetCollection<C>("csharp714", collectionSettings); _collection.Drop(); }
public void TestFixtureSetup() { server = MongoServer.Create("mongodb://localhost/?safe=true;slaveOk=true"); database = server["onlinetests"]; collection = database.GetCollection<C>("test"); collection.Drop(); }
public void TestFixtureSetup() { server = MongoServer.Create("mongodb://localhost/?safe=true"); database = server["onlinetests"]; collection = database["testcollection"]; collection.Drop(); }
public CSharp801() { _collection = LegacyTestConfiguration.GetCollection <C>(); if (_collection.Exists()) { _collection.Drop(); } }
public void Setup() { r = new PostRepository(); pb = new PostBuilder(); MongoSetup(); collection = database.GetCollection <Post>("posts"); collection.Drop(); }
public void SetUp() { _collection = LegacyTestConfiguration.GetCollection <C>(); if (_collection.Exists()) { _collection.Drop(); } }
public void Setup() { r = new PostRepository(); pb = new PostBuilder(); MongoSetup(); collection = database.GetCollection<Post>("posts"); collection.Drop(); }
public void SetUp() { _collection = Configuration.GetTestCollection<BsonDocument>(); if (_collection.Exists()) { _collection.Drop(); } _collection.Insert(new BsonDocument { { "x", 1 } }); _collection.Insert(new BsonDocument { { "x", 2 }, { "Length", BsonNull.Value } }); _collection.Insert(new BsonDocument { { "x", 3 }, { "Length", 123 } }); }
public CSharp840() { _collection = LegacyTestConfiguration.GetCollection<BsonDocument>(); if (_collection.Exists()) { _collection.Drop(); } _collection.Insert(new BsonDocument { { "x", 1 } }); _collection.Insert(new BsonDocument { { "x", 2 }, { "Length", BsonNull.Value } }); _collection.Insert(new BsonDocument { { "x", 3 }, { "Length", 123 } }); }
public void TestEnsureIndexAfterDropCollection() { if (collection.Exists()) { collection.Drop(); } server.ResetIndexCache(); Assert.IsFalse(collection.IndexExists("x")); collection.EnsureIndex("x"); Assert.IsTrue(collection.IndexExists("x")); collection.Drop(); Assert.IsFalse(collection.IndexExists("x")); collection.EnsureIndex("x"); Assert.IsTrue(collection.IndexExists("x")); }
public virtual void Purge() { Logger.Warn(Messages.PurgingStorage); PersistedCommits.Drop(); PersistedStreamHeads.Drop(); PersistedSnapshots.Drop(); }
public void TestFirstDeleteFailed() { var connection = _primary.AcquireConnection(); try { _collection.Drop(); _collection.Insert(new BsonDocument("_id", 1)); _collection.Insert(new BsonDocument("_id", 2)); _collection.Insert(new BsonDocument("_id", 3)); var deletes = new[] { new DeleteRequest(Query.And(Query.EQ("_id", 1), Query.Where("x"))), new DeleteRequest(Query.EQ("_id", 2)) }; var operation = CreateOperation(connection, _collection, deletes); var exception = Assert.Throws <BulkWriteException>(() => operation.Execute(connection)); var result = exception.Result; Assert.AreEqual(0, result.DeletedCount); Assert.AreEqual(0, result.Upserts.Count); var processedRequests = result.ProcessedRequests; Assert.AreEqual(1, processedRequests.Count); Assert.AreSame(deletes[0], processedRequests[0]); var unprocessedRequests = exception.UnprocessedRequests; Assert.AreEqual(1, unprocessedRequests.Count); Assert.AreSame(deletes[1], unprocessedRequests[0]); var errors = exception.WriteErrors; Assert.AreEqual(1, errors.Count); Assert.IsTrue(errors[0].Code > 0); Assert.IsTrue(errors[0].Message != null); Assert.AreEqual(0, errors[0].Index); Assert.AreEqual(3, _collection.Count()); } finally { _primary.ReleaseConnection(connection); } }
protected void ConfigureProjectionEngine(Boolean dropCheckpoints = true) { if (Engine != null) { Engine.Stop(); } if (dropCheckpoints) { _checkpoints.Drop(); } _tracker = new ConcurrentCheckpointTracker(Database); _statusChecker = new ConcurrentCheckpointStatusChecker(Database); var tenantId = new TenantId("engine"); var config = new ProjectionEngineConfig() { Slots = new[] { "*" }, EventStoreConnectionString = _eventStoreConnectionString, TenantId = tenantId, BucketInfo = new List <BucketInfo>() { new BucketInfo() { Slots = new[] { "*" }, BufferSize = 10 } }, DelayedStartInMilliseconds = 1000, ForcedGcSecondsInterval = 0, EngineVersion = "v2", }; RebuildSettings.Init(OnShouldRebuild(), OnShouldUseNitro()); _rebuildContext = new RebuildContext(RebuildSettings.NitroMode); StorageFactory = new MongoStorageFactory(Database, _rebuildContext); Func <IPersistStreams, CommitPollingClient> pollingClientFactory = ps => new CommitPollingClient( ps, new CommitEnhancer(_identityConverter), OnGetPollingClientId(), NullLogger.Instance); Engine = new ProjectionEngine( pollingClientFactory, _tracker, BuildProjections().ToArray(), new NullHouseKeeper(), _rebuildContext, new NullNotifyCommitHandled(), config ); Engine.LoggerFactory = Substitute.For <ILoggerFactory>(); Engine.LoggerFactory.Create(Arg.Any <Type>()).Returns(NullLogger.Instance); OnStartPolling(); }
public static void RemoveOldProfileData() { BookStoreContext mongo = new BookStoreContext(); mongo.Database.SetProfilingLevel(ProfilingLevel.None); MongoCollection <SystemProfileInfo> coll = mongo.Database.GetCollection <SystemProfileInfo>("system.profile"); coll.Drop(); }
public void CannAddCollection() { MongoCollection col = DataManager.Instance.Config.Database.GetCollection("Test1"); Assert.IsNotNull(col); col.Insert(new BsonDocument(new BsonElement("Test", "Test"))); col.Drop(); }
private void ExecuteMethod(MongoCollection obj) { var dba = new CollectionAction(); dba.Action = ActionType.Drop; dba.CollectionName = obj.Name; dba.Database = obj.Database; obj.Drop(); _eventAggregator.GetEvent <PubSubEvent <CollectionAction> >().Publish(dba); }
public static void DeletePSOIHCollections() { List <string> psoihList = GetPSOInheritedCollectionNames(); foreach (string s in psoihList) { YellowstonePathology.Business.Mongo.Server server = new Business.Mongo.TestServer(Business.Mongo.TestServer.LISDatabaseName); MongoCollection mongoCollection = server.Database.GetCollection <BsonDocument>(s); mongoCollection.Drop(); } }
public void TestFixtureSetup() { _database = Configuration.TestDatabase; var collectionSettings = new MongoCollectionSettings() { GuidRepresentation = GuidRepresentation.Standard }; _collection = _database.GetCollection <C>("csharp714", collectionSettings); _collection.Drop(); }
private void ButtonDeletePSODerivedCollections_Click(object sender, RoutedEventArgs e) { List <string> panelSetOrderDerivedList = ClassHelper.GetPanelSetOrderDerivedTableNames(); YellowstonePathology.Business.Mongo.LocalServer localServer = new Business.Mongo.LocalServer("LocalLIS"); foreach (string str in panelSetOrderDerivedList) { MongoCollection collection = localServer.Database.GetCollection <BsonDocument>(str); collection.Drop(); } }
public void OneTimeSetUp() { _database = LegacyTestConfiguration.Database; var collectionSettings = new MongoCollectionSettings() { GuidRepresentation = GuidRepresentation.Standard }; _collection = _database.GetCollection <C>("csharp714", collectionSettings); _collection.Drop(); }
public static void DropMongoCollection(string tableName) { YellowstonePathology.Business.Mongo.Server transferServer = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.SQLTransferDatabasename); MongoCollection transferCollection = transferServer.Database.GetCollection <BsonDocument>(tableName); transferCollection.Drop(); YellowstonePathology.Business.Mongo.Server lisServer = new Business.Mongo.TestServer(YellowstonePathology.Business.Mongo.MongoTestServer.LISDatabaseName); MongoCollection lisCollection = lisServer.Database.GetCollection <BsonDocument>(tableName.Substring(3)); lisCollection.Drop(); }
public void SetUp() { var connectionString = ConfigurationManager.ConnectionStrings["readmodel"].ConnectionString; var url = new MongoUrl(connectionString); var client = new MongoClient(url); _db = client.GetServer().GetDatabase(url.DatabaseName); var sut = new ConcurrentCheckpointTracker(_db); _checkPoints = _db.GetCollection <Checkpoint>("checkpoints"); _checkPoints.Drop(); }
public void Setup() { _collection = LegacyTestConfiguration.GetCollection<B>(); _collection.Drop(); _collection.CreateIndex("Value", "SubValues.Value"); //numeric _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = (byte)1, SubValues = new List<C>() { new C(2f), new C(3), new C(4D), new C(5UL) } }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = 2f, SubValues = new List<C>() { new C(6f), new C(7), new C(8D), new C(9UL) } }); //strings _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = "1", SubValues = new List<C>() { new C("2"), new C("3"), new C("4"), new C("5") } }); }
public void Context() { var connectionStringUrl = new MongoUrl("mongodb://localhost/integration_tests"); MongoDatabase mongoDatabase = MongoDatabase.Create(connectionStringUrl); mongoCollection = mongoDatabase.GetCollection("end_to_end_tests"); if(mongoCollection.Exists()) { mongoCollection.Drop(); } var elementWithIEnumerableProperty = new ElementWithIEnumerableProperty{Name = "Test", Objects = new List<object>{"Test value for serialization"}.Select(x =>x)}; mongoCollection.Insert(elementWithIEnumerableProperty); }
public MongoDbProcessManagerFinderTests() { _connectionString = "mongodb://localhost/"; _dbName = "ProcessManagerRepository"; var mongoClient = new MongoClient(_connectionString); MongoServer server = mongoClient.GetServer(); MongoDatabase mongoDatabase = server.GetDatabase(_dbName); _collection = mongoDatabase.GetCollection<TestData>("TestData"); _collection.Drop(); _mapper = new ProcessManagerPropertyMapper(); _mapper.ConfigureMapping<IProcessManagerData, Message>(m => m.CorrelationId, pm => pm.CorrelationId); }
public void Setup() { _collection = LegacyTestConfiguration.GetCollection<B>(); _collection.Drop(); _collection.CreateIndex(new IndexKeysBuilder().Ascending("a", "b"), IndexOptions.SetName("i")); _collection.CreateIndex(new IndexKeysBuilder().Ascending("a", "b"), IndexOptions.SetName("i")); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 1, b = 10, c = 100 }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 2, b = 20, c = 200 }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 3, b = 30, c = 300 }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 4, b = 40, c = 400 }); }
public MongoDbProcessManagerFinderTests() { _connectionString = "mongodb://localhost/"; _dbName = "ProcessManagerRepository"; var mongoClient = new MongoClient(_connectionString); MongoServer server = mongoClient.GetServer(); MongoDatabase mongoDatabase = server.GetDatabase(_dbName); _collection = mongoDatabase.GetCollection<TestData>("TestData"); _collection.Drop(); _mapper = new ProcessManagerPropertyMapper(); _mapper.ConfigureMapping<IProcessManagerData, Message>(m => m.CorrelationId, pm => pm.CorrelationId); }
public void TestFetchDBRef() { _collection.Drop(); _collection.Insert(new BsonDocument { { "_id", 1 }, { "x", 2 } }); var dbRef = new MongoDBRef(_database.Name, _collection.Name, 1); var document = _server.FetchDBRef(dbRef); Assert.AreEqual(2, document.ElementCount); Assert.AreEqual(1, document["_id"].AsInt32); Assert.AreEqual(2, document["x"].AsInt32); }
public void Setup() { server = MongoServer.Create("mongodb://localhost/?safe=true"); server.Connect(); database = server["onlinetests"]; collection = database.GetCollection<C>("linqtests"); collection.Drop(); collection.Insert(new C { X = 1, Y = 11 }); collection.Insert(new C { X = 2, Y = 12 }); collection.Insert(new C { X = 3, Y = 13 }); collection.Insert(new C { X = 4, Y = 14 }); collection.Insert(new C { X = 5, Y = 15 }); }
public void Setup() { _server = Configuration.TestServer; _server.Connect(); _database = Configuration.TestDatabase; _collection = Configuration.GetTestCollection<C>(); _collection.Drop(); _collection.Insert(new C { X = 1, Y = 11 }); _collection.Insert(new C { X = 2, Y = 12 }); _collection.Insert(new C { X = 3, Y = 13 }); _collection.Insert(new C { X = 4, Y = 14 }); _collection.Insert(new C { X = 5, Y = 15 }); }
public void TestReplaceWithInvalidFieldName() { _collection.Drop(); _collection.Insert(new BsonDocument { { "_id", 1 }, { "x", 1 } }); var query = Query.EQ("_id", 1); var update = Update.Replace(new BsonDocument { { "_id", 1 }, { "$x", 1 } }); Assert.Throws <BsonSerializationException>(() => { _collection.Update(query, update); }); }
//Remove a item. private bool drop() { MongoServer server = MongoServer.Create(connectionString); MongoDatabase db = server.GetDatabase("testdb"); MongoCollection <Book> collection = db.GetCollection <Book>("Library"); if (tboxName.Text == "") { DialogResult dr = MessageBox.Show("确定要删除所有记录吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { collection.Drop(); dataGridView1.DataSource = new BindingList <Book>(db.GetCollection <Book>("Library").FindAll().ToList()); return(true); } else { return(false); } } else { DialogResult dr = MessageBox.Show("确定要删除吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { string bookname = tboxBookName.Text; string name = tboxName.Text; string borrowdate = tboxBorrowDate.Text; string returndate = tboxRetrunDate.Text; //删除,首先进行实体类的查询,获取id才能够删除。 var Book = new Book(Name = name); collection.Insert(Book); var id = Book.Id; var query = Query <Book> .EQ(q => q.Name, name); var queryid = Query <Book> .EQ(q => q.Id, id); collection.Remove(query); collection.Remove(queryid); dataGridView1.DataSource = new BindingList <Book>(db.GetCollection <Book>("Library").FindAll().ToList()); return(true); } else { return(false); } } }
public void Setup() { _server = Configuration.TestServer; _database = Configuration.TestDatabase; _collection = Configuration.GetTestCollection<B>(); _collection.Drop(); _collection.EnsureIndex(new IndexKeysBuilder().Ascending("a", "b"), IndexOptions.SetName("i")); _collection.EnsureIndex(new IndexKeysBuilder().Ascending("a", "b"), IndexOptions.SetName("i")); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 1, b = 10, c = 100 }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 2, b = 20, c = 200 }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 3, b = 30, c = 300 }); _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 4, b = 40, c = 400 }); }
public virtual void Setup() { collection = new MongoClient(ConfigurationManager.AppSettings["mongoQueueUrl"]) .GetServer() .GetDatabase(ConfigurationManager.AppSettings["mongoQueueDb"]) .GetCollection(ConfigurationManager.AppSettings["mongoQueueCollection"]); collection.Drop(); gridfs = collection.Database.GetGridFS(MongoGridFSSettings.Defaults); gridfs.Files.Drop(); gridfs.Chunks.Drop(); queue = new Queue(); }
internal MongoDbPessimisticLocker(MongoDatabase database, int ttl, bool dropCollection) { locks = database.GetCollection<PessimisticLockDto>("PessimisticLocks"); if (dropCollection) locks.Drop(); var indexes = locks.GetIndexes().ToArray(); var tsIndex = indexes.FirstOrDefault(x => x.Name != "ts"); if (tsIndex == null) { locks.CreateIndex(new IndexKeysBuilder().Ascending("ts"), new IndexOptionsBuilder().SetTimeToLive(TimeSpan.FromSeconds(ttl)).SetName("ts")); } locks.CreateIndex(new IndexKeysBuilder().Ascending("kid"), new IndexOptionsBuilder().SetUnique(false)); }
public void SetUp() { _databaseName = ConfigurationManager.ConnectionStrings["mongodb"].ProviderName; _collectionName = typeof(Product).Name.ToLower(); //Doing this by hand instead of container spec var server = MongoServerFactory.Build(); server.DropDatabase(_databaseName); _database = server.GetDatabase(_databaseName); _collection = _database.GetCollection<Product>(_collectionName); _collection.Drop(); PopulateCollectionWithRandomProducts(100000); }
public void Setup() { _collection = LegacyTestConfiguration.GetCollection<C>(); var de = new Dictionary<string, int>(); var dx = new Dictionary<string, int>() { { "x", 1 } }; var dy = new Dictionary<string, int>() { { "y", 1 } }; var he = new Hashtable(); var hx = new Hashtable { { "x", 1 } }; var hy = new Hashtable { { "y", 1 } }; _collection.Drop(); _collection.Insert(new C { D = null, E = null, F = null, H = null, I = null, J = null }); _collection.Insert(new C { D = de, E = de, F = de, H = he, I = he, J = he }); _collection.Insert(new C { D = dx, E = dx, F = dx, H = hx, I = hx, J = hx }); _collection.Insert(new C { D = dy, E = dy, F = dy, H = hy, I = hy, J = hy }); }
public void Setup() { _server = Configuration.TestServer; _database = Configuration.TestDatabase; _collection = Configuration.GetTestCollection<C>(); var de = new Dictionary<string, int>(); var dx = new Dictionary<string, int>() { { "x", 1 } }; var dy = new Dictionary<string, int>() { { "y", 1 } }; var he = new Hashtable(); var hx = new Hashtable { { "x", 1 } }; var hy = new Hashtable { { "y", 1 } }; _collection.Drop(); _collection.Insert(new C { D = null, E = null, F = null, G = null, H = null, I = null, J = null, K = null }); _collection.Insert(new C { D = de, E = de, F = de, G = de, H = he, I = he, J = he, K = he }); _collection.Insert(new C { D = dx, E = dx, F = dx, G = dx, H = hx, I = hx, J = hx, K = hx }); _collection.Insert(new C { D = dy, E = dy, F = dy, G = dy, H = hy, I = hy, J = hy, K = hy }); }
public void SetUp() { var db = Configuration.TestDatabase; _collection = db.GetCollection<GeoClass>("geo"); _collection.Drop(); _collection.CreateIndex(IndexKeys<GeoClass>.GeoSpatialSpherical(x => x.Location)); _collection.CreateIndex(IndexKeys<GeoClass>.GeoSpatialSpherical(x => x.Surrounding)); var doc = new GeoClass { Id = 1, Location = GeoJson.Point(GeoJson.Geographic(40.5, 18.5)), Surrounding = GeoJson.Polygon( GeoJson.Geographic(40, 18), GeoJson.Geographic(40, 19), GeoJson.Geographic(41, 19), GeoJson.Geographic(40, 18)) }; _collection.Save(doc); }
private void SeedData(MongoDatabase db) { if (db == null) throw new ArgumentNullException("db"); // Reset db db.GetCollection("IDSequence").Drop(); _usersCol = db.GetCollection<MembershipAccount>(MembershipAccount.GetCollectionName()); _usersCol.Drop(); var salt = Crypto.GenerateSalt(); var user1 = new MembershipAccount("User1") { PasswordSalt = salt, Password = Crypto.HashPassword("p@ssword" + salt), IsConfirmed = false }; var user2 = new MembershipAccount("NonLocalUser") { IsLocalAccount = false, IsConfirmed = true }; _usersCol.InsertBatch(new[] { user1, user2 }); var oAuthTokenCol = db.GetCollection<OAuthToken>(OAuthToken.GetCollectionName()); oAuthTokenCol.Drop(); oAuthTokenCol.Insert(new OAuthToken("Tok3n", "tok3nSecret")); var oAuthMembershipCol = db.GetCollection<OAuthMembership>(OAuthMembership.GetCollectionName()); oAuthMembershipCol.Drop(); oAuthMembershipCol.Insert( new OAuthMembership("Test", "User1@Test", 1) ); Users = _usersCol.AsQueryable(); OAuthTokens = oAuthTokenCol.AsQueryable(); OAuthMemberships = oAuthMembershipCol.AsQueryable(); }
public void TestFixtureSetup() { _collection = LegacyTestConfiguration.GetCollection<GDA>(); _collection.Drop(); }
public void OneTimeSetUp() { _collection = LegacyTestConfiguration.GetCollection<GDA>(); _collection.Drop(); }
private static bool OneTimeSetup() { __collection = LegacyTestConfiguration.Collection; __collection.Drop(); return true; }
public CSharp524Tests() { _collection = LegacyTestConfiguration.GetCollection<C>(); _collection.Drop(); }
public virtual void Setup() { collection = new MongoClient(ConfigurationManager.AppSettings["mongoQueueUrl"]) .GetServer() .GetDatabase(ConfigurationManager.AppSettings["mongoQueueDb"]) .GetCollection(ConfigurationManager.AppSettings["mongoQueueCollection"]); collection.Drop(); queue = new Queue(); }
public void SetUp() { _collection = LegacyTestConfiguration.GetCollection<C>(); if (_collection.Exists()) { _collection.Drop(); } }
public void TestFixtureSetup() { _collection = Configuration.GetTestCollection<C>(); _collection.Drop(); }