public void Can_query_post_after_dynamic_insert() { //Arrange var store = GetStore(); DynamicSession.AddClrType("Posts", typeof(Post)); using (dynamic session = store.OpenDynamicSession()) { session.posts.insert(new { Name = "Hello World" }, 123); session.SaveChanges(); } //Act Post result; using (var session = store.OpenSession()) { result = session.Load <Post>("posts/123"); } //Assert Assert.That(result, Is.Not.Null); Assert.That(result.Name, Is.EqualTo("Hello World")); }
public void Can_insert_with_lowercase_insert_keyword() { //Arrange var store = GetStore(); DynamicSession.AddClrType("Bananas", typeof(Banana)); using (dynamic session = store.OpenDynamicSession()) { session.Bananas.insert(new { Colour = "Yellow", Bunch = 14 }, 1); session.SaveChanges(); } Banana result; using (var session = store.OpenSession()) { result = session.Load <Banana>("bananas/1"); } Assert.That(result, Is.Not.Null); Assert.That(result.Colour, Is.EqualTo("Yellow")); }