fcl-db: tests: cosmetic + correct typos

git-svn-id: trunk@29451 -
This commit is contained in:
lacak 2015-01-12 13:59:17 +00:00
parent 9b468ba728
commit d033c7e122

View File

@ -31,7 +31,6 @@ type
private private
FMyQ: TSQLQuery; FMyQ: TSQLQuery;
procedure DoAfterPost(DataSet: TDataSet); procedure DoAfterPost(DataSet: TDataSet);
Procedure Allow;
Procedure DoApplyUpdates; Procedure DoApplyUpdates;
Procedure SetQueryOptions; Procedure SetQueryOptions;
Procedure TrySetPacketRecords; Procedure TrySetPacketRecords;
@ -87,16 +86,6 @@ implementation
{ TTestTSQLQuery } { TTestTSQLQuery }
procedure TTestTSQLQuery.DoAfterPost(DataSet: TDataSet);
begin
AssertTrue('Have modifications in after post',FMyq.UpdateStatus=usModified)
end;
Procedure TTestTSQLQuery.Allow;
begin
end;
procedure TTestTSQLQuery.TestMasterDetail; procedure TTestTSQLQuery.TestMasterDetail;
var MasterQuery, DetailQuery: TSQLQuery; var MasterQuery, DetailQuery: TSQLQuery;
MasterSource: TDataSource; MasterSource: TDataSource;
@ -264,6 +253,11 @@ begin
end; end;
end; end;
procedure TTestTSQLQuery.DoAfterPost(DataSet: TDataSet);
begin
AssertTrue('Have modifications in after post',FMyq.UpdateStatus=usModified)
end;
Procedure TTestTSQLQuery.TestAutoApplyUpdatesPost; Procedure TTestTSQLQuery.TestAutoApplyUpdatesPost;
var Q: TSQLQuery; var Q: TSQLQuery;
I: Integer; I: Integer;
@ -416,10 +410,10 @@ begin
Q.Insert; Q.Insert;
Q.FieldByName('id').AsInteger:=1; Q.FieldByName('id').AsInteger:=1;
Q.Post; Q.Post;
AssertTrue('field value has not been fetched after post',Q.FieldByName('a').IsNull); AssertTrue('Field value has not been fetched after post',Q.FieldByName('a').IsNull);
Q.ApplyUpdates(0); Q.ApplyUpdates(0);
AssertEquals('Still on correc field',1,Q.FieldByName('id').AsInteger); AssertEquals('Still on correct field',1,Q.FieldByName('id').AsInteger);
AssertEquals('field value has been fetched from the database ','abcde',Q.FieldByName('a').AsString); AssertEquals('Field value has been fetched from the database ','abcde',Q.FieldByName('a').AsString);
end; end;
Procedure TTestTSQLQuery.TestGeneratedRefreshSQL; Procedure TTestTSQLQuery.TestGeneratedRefreshSQL;
@ -448,11 +442,11 @@ begin
Q.Insert; Q.Insert;
Q.FieldByName('id').AsInteger:=1; Q.FieldByName('id').AsInteger:=1;
Q.Post; Q.Post;
AssertTrue('field value has not been fetched after post',Q.FieldByName('a').IsNull); AssertTrue('Field value has not been fetched after post',Q.FieldByName('a').IsNull);
Q.ApplyUpdates(0); Q.ApplyUpdates(0);
AssertEquals('Still on correc field',1,Q.FieldByName('id').AsInteger); AssertEquals('Still on correct field',1,Q.FieldByName('id').AsInteger);
AssertEquals('field value has been fetched from the database ','abcde',Q.FieldByName('a').AsString); AssertEquals('Field value has been fetched from the database ','abcde',Q.FieldByName('a').AsString);
AssertEquals('field value has been fetched from the database ','fgh',Q.FieldByName('b').AsString); AssertEquals('Field value has been fetched from the database ','fgh',Q.FieldByName('b').AsString);
end; end;
Procedure TTestTSQLQuery.TestGeneratedRefreshSQL1Field; Procedure TTestTSQLQuery.TestGeneratedRefreshSQL1Field;
@ -478,11 +472,11 @@ begin
Q.Insert; Q.Insert;
Q.FieldByName('id').AsInteger:=1; Q.FieldByName('id').AsInteger:=1;
Q.Post; Q.Post;
AssertTrue('field value has not been fetched after post',Q.FieldByName('a').IsNull); AssertTrue('Field value has not been fetched after post',Q.FieldByName('a').IsNull);
Q.ApplyUpdates(0); Q.ApplyUpdates(0);
AssertEquals('Still on correc field',1,Q.FieldByName('id').AsInteger); AssertEquals('Still on correct field',1,Q.FieldByName('id').AsInteger);
AssertEquals('field value a has been fetched from the database ','abcde',Q.FieldByName('a').AsString); AssertEquals('Field value a has been fetched from the database ','abcde',Q.FieldByName('a').AsString);
AssertEquals('field value b has NOT been fetched from the database ','',Q.FieldByName('b').AsString); AssertEquals('Field value b has NOT been fetched from the database ','',Q.FieldByName('b').AsString);
end; end;
Procedure TTestTSQLQuery.TestGeneratedRefreshSQLNoKey; Procedure TTestTSQLQuery.TestGeneratedRefreshSQLNoKey;
@ -560,7 +554,7 @@ begin
FMyQ.Insert; FMyQ.Insert;
FMyQ.FieldByName('id').AsInteger:=1; FMyQ.FieldByName('id').AsInteger:=1;
FMyQ.Post; FMyQ.Post;
AssertException('Multiple records returned by RefreshSQL gives an error',EUpdateError,@DoApplyUpdates); AssertException('No records returned by RefreshSQL gives an error',EUpdateError,@DoApplyUpdates);
end; end;
Procedure TTestTSQLQuery.TestFetchAutoInc; Procedure TTestTSQLQuery.TestFetchAutoInc;