示例#1
0
        public void SelectByHashFromBegin()
        {
            var testData   = dataFactory.Create(1);
            var resultData = db.GetCollection <TestData>()
                             .FindById(testData.Id)
                             ?? throw new InvalidOperationException($"Document #1 is not found");

            if (resultData.Id != testData.Id)
            {
                throw new InvalidOperationException($"Document #1 is wrong");
            }
        }
示例#2
0
 public void SelectByHashFromBegin()
 {
     using (var tx = env.BeginTransaction())
         using (var db = tx.OpenDatabase("test"))
         {
             var testData = dataFactory.Create(1);
             var data     = Encoding.UTF8.GetString(tx.Get(db, Encoding.UTF8.GetBytes(testData.Id)));
             if (!data.Equals(testData.Data))
             {
                 throw new InvalidOperationException($"Document #1 is wrong");
             }
         }
 }
示例#3
0
 private IEnumerable <TestData> CreateBatch(int size)
 {
     return(Enumerable.Range(1, size)
            .Select(_ => testFactory.Create(++currentId)).OrderBy(td => td.Id));
 }