public void Can_ExecuteNonQueryAsync() { using (var cmd = NWindDatabase.GetSqlCommand(SQL_REGION_DELETE)) using (var asyncTask = SqlCommandAsync.ExecuteNonQueryAsync(NWindDatabase, cmd)) { asyncTask.Wait(); AssertTaskIsCompleted(asyncTask); // ExecuteNonQuery를 수행하면, 삭제한 레코드가 없기 때문에 결과 값은 0 입니다. // Assert.AreEqual(0, asyncTask.Result); } }
public void Can_Raise_Exception_When_Invalid_Query() { Assert.Throws <AggregateException>(() => With.TryActionAsync(() => { using ( var cmd = NWindDatabase.GetSqlCommand("SELECT * FRO sysobjects")) { var table = SqlCommandAsync.ExecuteDataTableAsync(NWindDatabase, cmd). Result; Assert.IsNotNull(table); } }, age => { throw new AggregateException(age); })); }