Exemplo n.º 1
0
        public void ShouldAddWhereClauseToExistingQueryBuilder()
        {
            transaction.Query <object>().Returns(TableQueryBuilder("Accounts"));

            var query = transaction.Query <object>();

            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            query.Where("Id", UnarySqlOperand.Equal, 1);

            // Old versions of Query returned a stateful object, while now each call is stateless - it returns a new object.
            // It's invalid to call a method twice
            Assert.Throws <Exception>(() => query.ToList());
        }
Exemplo n.º 2
0
        public override void SetUp()
        {
            base.SetUp();
            var config = new RelationalStoreConfiguration(ConnectionString);

            config.DocumentMaps.Register(new CustomerMap());

            store       = new RelationalStore(config);
            transaction = store.BeginReadTransaction();

            allIdsRandomlySorted = transaction.Query <Customer>().ToList().Select(p => p.Id).OrderByDescending(p => Guid.NewGuid()).ToList();
        }
Exemplo n.º 3
0
 public List <Customer> List100CustomersQueryWhereText()
 {
     return(EnsureResults(
                transaction.Query <Customer>().Where("FirstName = @name").Parameter("name", "Robert").Take(100).ToList()
                ));
 }