public void ShouldExeccutePreparedQueryByName() { var query = new PreparedQuery("select from Profile where name = :name and surname = :surname"); var docMichael = _database .Query(query) .Set("name", "Michael") .Set("surname", "Blach") .Run().SingleOrDefault(); Assert.NotNull(docMichael); Assert.Equal(docMichael.GetField<string>("name"), "Michael"); Assert.Equal(docMichael.GetField<string>("surname"), "Blach"); var docLuca = _database .Query(query) .Set("name", "Luca") .Set("surname", "Garulli") .Run().SingleOrDefault(); Assert.NotNull(docLuca); Assert.Equal(docLuca.GetField<string>("name"), "Luca"); Assert.Equal(docLuca.GetField<string>("surname"), "Garulli"); }
public void ShouldExeccutePreparedQueryByPossition() { var query = new PreparedQuery("select from Profile where name = ? and surname = ?"); var docMichael = _database .Query(query) .Run("Michael", "Blach").SingleOrDefault(); Assert.That(docMichael, Is.Not.Null); Assert.That(docMichael.GetField<string>("name"), Is.EqualTo("Michael")); Assert.That(docMichael.GetField<string>("surname"), Is.EqualTo("Blach")); var docLuca = _database .Query(query) .Run("Luca", "Garulli").SingleOrDefault(); Assert.That(docLuca, Is.Not.Null); Assert.That(docLuca.GetField<string>("name"), Is.EqualTo("Luca")); Assert.That(docLuca.GetField<string>("surname"), Is.EqualTo("Garulli")); }