public void should_use_configuration_database_when_specified() { using (var session = new TemporarySession()) { using (var anotherSession = new TemporarySession()) { Documents.Configure <TestDoc>(database: anotherSession.DatabaseName); var testObject = new TestDoc { Text = "hello world" }; var info = session.Save(testObject, "test"); var fromDb = session.Get <JObject>(info.Id); fromDb.ShouldBe(null); session.DatabaseName.ShouldBe(session.DefaultDatabase); var fromDb2 = session.Get <TestDoc>(info.Id); fromDb2.ShouldNotBe(null); var info2 = session.Documents.Save(testObject); info2.Id.ShouldBe(info.Id); session.DatabaseName.ShouldBe(session.DefaultDatabase); } } }
public void db_put_get_delete() { using (var session = new TemporarySession()) { var testObject = new TestDoc { Text = "hello world" }; var result = session.Get <TestDoc>("test"); Assert.That(result, Is.Null); var info = session.Save(testObject, "test"); testObject.Text = "hello world chagned"; session.Save(testObject); testObject.Text = "hello world changed"; info = session.Save(testObject); testObject.Text = "hello world changed 2"; session.Save(testObject, info); session.Delete(testObject); result = session.Get <TestDoc>("test"); Assert.That(result, Is.Null); } }
public void should_allow_keys_to_contain_slashes() { using (var session = new TemporarySession()) { var testObject1 = new TestDoc { _id = "test/1", Text = "hello world" }; var result1 = session.Get <TestDoc>("test/1"); Assert.That(result1, Is.Null); session.Save(testObject1, testObject1._id); var result2 = session.Get <TestDoc>("test/1"); Assert.That(result2, Is.Not.Null); Assert.That(result2._id == "Test/1"); var testObject2 = new TestDoc { _id = "test/2", Text = "hello world" }; var result3 = session.Get <TestDoc>("test/2"); Assert.That(result3, Is.Null); session.Save(testObject2, testObject2._id); var result4 = session.Get <TestDoc>("test/2"); Assert.That(result4, Is.Not.Null); Assert.That(result4._id == "Test/2"); } }