public void Insert_TypedDocumentWithAutoAssignedId_IsStored() { var document = new PersonWithAutoId { Name = "Daniel" }; using (var session = new SimoSession(TestHelper.CreateConnection())) { session[DbName][PersonsCollectionName].Insert(document); } var numOfDocs = TestHelper.GetDocumentCount(new { document._id }, Constants.Collections.PersonsCollectionName); Assert.AreEqual(1, numOfDocs); }
public void InsertSingle_TypedDocumentWithAutoId_IsStoredAndAssignedId() { var person2Insert = new PersonWithAutoId { Name = "Daniel", Age = 29 }; using (var cn = TestHelper.CreateConnection()) { var insertCommand = new InsertDocumentsCommand(cn) { FullCollectionName = Constants.Collections.PersonsFullCollectionName, Documents = new[] { person2Insert } }; insertCommand.Execute(); } var refetched = TestHelper.GetDocuments<PersonWithId>(new { person2Insert._id }, Constants.Collections.PersonsCollectionName); Assert.AreEqual(1, refetched.Count); }