Check TBaseProxy.Create() parameters for valid input + tests

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@787 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2009-05-06 16:59:01 +00:00
parent 20cd52f952
commit 0ba1744496
4 changed files with 133 additions and 16 deletions

View File

@ -0,0 +1,101 @@
{ This file is part of the Web Service Toolkit
Copyright (c) 2006, 2007, 2008, 2009 by Inoussa OUEDRAOGO
This file is provide under modified LGPL licence
( the files COPYING.modifiedLGPL and COPYING.LGPL).
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}
{$INCLUDE wst_global.inc}
unit test_support_client;
interface
uses
Classes, SysUtils,
{$IFDEF FPC}
fpcunit, testregistry,
{$ELSE}
TestFrameWork,
{$ENDIF}
TypInfo,
wst_types, base_service_intf, imp_utils, test_suite_utils, service_intf;
type
{ TTest_TBaseProxy }
TTest_TBaseProxy = class(TWstBaseTest)
published
procedure test_CreateWithInvalidParameters_AProtocol();
procedure test_CreateWithInvalidParameters_AProtocolData();
procedure test_CreateWithInvalidParameters_ATransportData();
end;
implementation
uses
//Include this so we are sure to have a valid transport protocol registered
same_process_protocol,
//Include this so we are sure to have a valid serialization protocol registered
binary_formatter;
const
s_target_service = 'SampleService';
{ TTest_TBaseProxy }
procedure TTest_TBaseProxy.test_CreateWithInvalidParameters_AProtocol();
var
ok : Boolean;
sp : IServiceProtocol;
begin
ok := False;
try
sp := nil;
TBaseProxy.Create(s_target_service,sp);
except
ok := True;
end;
Check(ok);
end;
procedure TTest_TBaseProxy.test_CreateWithInvalidParameters_AProtocolData();
var
ok : Boolean;
sp : IServiceProtocol;
begin
ok := False;
try
sp := nil;
TBaseProxy.Create(s_target_service,'NILPROTOCOL:nil_prop=nilvalue','SAME_PROCESS:');
except
ok := True;
end;
Check(ok);
end;
procedure TTest_TBaseProxy.test_CreateWithInvalidParameters_ATransportData();
var
ok : Boolean;
sp : IServiceProtocol;
begin
ok := False;
try
sp := nil;
TBaseProxy.Create(s_target_service,'binary:','NILPROTOCOL:');
except
ok := True;
end;
Check(ok);
end;
initialization
SAME_PROCESS_Register_Local_Transport();
RegisterTest('Support-Client',TTest_TBaseProxy.Suite);
end.

View File

@ -37,7 +37,7 @@
<PackageName Value="fpcunittestrunner"/>
</Item3>
</RequiredPackages>
<Units Count="20">
<Units Count="22">
<Unit0>
<Filename Value="wst_test_suite_gui.lpr"/>
<IsPartOfProject Value="True"/>
@ -138,6 +138,16 @@
<IsPartOfProject Value="True"/>
<UnitName Value="config_objects"/>
</Unit19>
<Unit20>
<Filename Value="test_support_client.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_support_client"/>
</Unit20>
<Unit21>
<Filename Value="..\..\wst_consts.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="wst_consts"/>
</Unit21>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -18,7 +18,8 @@ uses
test_basex_encode, json_formatter, server_service_json, test_json,
test_suite_utils, test_generators, fpcunittestrunner, test_std_cursors,
test_rtti_filter, rtti_filters, wst_cursors, test_wst_cursors, test_registry, test_soap_specific,
test_generators_runtime, test_date_utils, config_objects;
test_generators_runtime, test_date_utils, config_objects, test_support_client,
wst_consts;
begin
Application.Initialize;