Exemplo n.º 1
0
 public void QueryableExecuteSucceedsOnRetry()
 {
     using (var context = new MemoryTestDataContext())
     {
         InitializeData(context);
         context.RetryCount = 1;
         Assert.AreEqual(2, context.TestObjects.Where(x => x.Bool).Retry(new TestLinearRetry()).Count());
     }
 }
Exemplo n.º 2
0
 public void QueryableExecuteThrowsException()
 {
     using (var context = new MemoryTestDataContext())
     {
         InitializeData(context);
         context.RetryCount = 1;
         Assert.Throws <TestSqlException>(() => context.TestObjects.Where(x => x.Bool).Count());
     }
 }
Exemplo n.º 3
0
 public void SubmitChangesThrowsException()
 {
     using (var context = new MemoryTestDataContext())
     {
         InitializeData(context);
         context.RetryCount = 1;
         context.TestObjects.InsertOnSubmit(new TestObject());
         Assert.Throws <TestSqlException>(() => context.SubmitChanges());
     }
 }
Exemplo n.º 4
0
 public void SubmitChangesSucceedsOnRetry()
 {
     using (var context = new MemoryTestDataContext())
     {
         InitializeData(context);
         context.RetryCount = 1;
         context.TestObjects.InsertOnSubmit(new TestObject());
         Assert.DoesNotThrow(() => new TestLinearRetry().Retry(() => context.SubmitChanges()));
         Assert.AreEqual(4, context.TestObjects.Count());
     }
 }
Exemplo n.º 5
0
 private void InitializeData(MemoryTestDataContext context)
 {
     context.TestObjects.InsertOnSubmit(new TestObject
     {
         String = "A",
         Number = 10,
         Bool   = true
     });
     context.TestObjects.InsertOnSubmit(new TestObject
     {
         String = "B",
         Number = 100,
         Bool   = true
     });
     context.TestObjects.InsertOnSubmit(new TestObject
     {
         String = "C",
         Number = 1000,
         Bool   = false
     });
     context.SubmitChanges();
 }