messagingfw/msgurlhandler/test/basic/inc/SmsSchemeHandlerTransitionValidation.inl
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The implementation of the transition validation classes upon the CSmsSchemeHandler class methods.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @SYMCreationDate Created : 01/06/01 14:07:24
       
    21 */
       
    22 
       
    23 // ______________________________________________________________________________
       
    24 //
       
    25 inline TSmsSchemeHandler_Ctor_TransitionValidator::TSmsSchemeHandler_Ctor_TransitionValidator(CUnitTestContext& aUTContext)
       
    26 :TTransitionValidator(aUTContext)
       
    27 	{
       
    28 	// Do nothing
       
    29 	}
       
    30 
       
    31 inline TBool TSmsSchemeHandler_Ctor_TransitionValidator::ValidatePreConditions()
       
    32 	{
       
    33 	if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler))
       
    34 		return EFalse;
       
    35 	return ETrue;
       
    36 	}
       
    37 
       
    38 inline TBool TSmsSchemeHandler_Ctor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
       
    39 	{
       
    40 	if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler))
       
    41 		return EFalse;
       
    42 	return ETrue;
       
    43 	}
       
    44 
       
    45 // ______________________________________________________________________________
       
    46 //
       
    47 inline TSmsSchemeHandler_Dtor_TransitionValidator::TSmsSchemeHandler_Dtor_TransitionValidator(CUnitTestContext& aUTContext)
       
    48 :TTransitionValidator(aUTContext)
       
    49 	{
       
    50 	// Do nothing
       
    51 	}
       
    52 
       
    53 inline TBool TSmsSchemeHandler_Dtor_TransitionValidator::ValidatePreConditions()
       
    54 	{
       
    55 	if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler))
       
    56 		return EFalse;
       
    57 	return ETrue;
       
    58 	}
       
    59 
       
    60 inline TBool TSmsSchemeHandler_Dtor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
       
    61 	{
       
    62 	if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler))
       
    63 		return EFalse;
       
    64 	return ETrue;
       
    65 	}
       
    66 
       
    67 
       
    68 // ______________________________________________________________________________
       
    69 //
       
    70 inline TSmsSchemeHandler_ParseUrlL_TransitionValidator::TSmsSchemeHandler_ParseUrlL_TransitionValidator(CUnitTestContext& aUTContext)
       
    71 :TTransitionValidator(aUTContext)
       
    72 	{
       
    73 	// Do nothing
       
    74 	}
       
    75 
       
    76 inline TBool TSmsSchemeHandler_ParseUrlL_TransitionValidator::ValidatePreConditions()
       
    77 	{
       
    78 	if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler))
       
    79 		return EFalse;
       
    80 	return ETrue;
       
    81 	}
       
    82 
       
    83 inline TBool TSmsSchemeHandler_ParseUrlL_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
       
    84 	{
       
    85 	if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler))
       
    86 		return EFalse;
       
    87 
       
    88 	CSmsSchemeHandler* schemeHandler = REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iSmsSchemeHandler;
       
    89 	TSmsSchemeHandler_StateAccessor* stateAccessor = &REINTERPRET_CAST(TSmsSchemeHandler_StateAccessor&, iUTContext.StateAccessor());
       
    90 	RArray<SSmsNumber> smsArray = stateAccessor->GetSmsArray(*schemeHandler);
       
    91 	const TInt smsCount = smsArray.Count();
       
    92 
       
    93 	RArray<CSmsSchemeHandler_UnitTestContext::SSmsNumber> postCheck = REINTERPRET_CAST(CSmsSchemeHandler_UnitTestContext&,iUTContext).iPostCheck;
       
    94 
       
    95 	for (TInt i=0; i<smsCount; ++i)
       
    96 		{
       
    97 		iUTContext.DataLogger().LogInformation(smsArray[i].iNumber);
       
    98 		//iUTContext.DataLogger().LogInformation(postCheck[i].iNumber);
       
    99 		if ((smsArray[i].iNumber).CompareF(postCheck[i].iNumber) != 0)
       
   100 			{
       
   101 			iUTContext.DataLogger().LogInformation(_L("***** TEST FAILED *****"));
       
   102 			return EFalse;
       
   103 			}
       
   104 
       
   105 		iUTContext.DataLogger().LogInformation(smsArray[i].iServiceCentre);
       
   106 		//iUTContext.DataLogger().LogInformation(postCheck[i].iServiceCentre);
       
   107 		if ((smsArray[i].iServiceCentre).CompareF(postCheck[i].iServiceCentre) != 0)
       
   108 			{
       
   109 			iUTContext.DataLogger().LogInformation(_L("***** TEST FAILED *****"));
       
   110 			return EFalse;
       
   111 			}
       
   112 		}
       
   113 
       
   114 	return ETrue;
       
   115 	}