void CMtfTestActionGetAttachmentFileFromIndex::RunTestActionL()
	{
	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
	TInt attachIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));
	HBufC* dataFilePath   = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3), NULL);

	CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
	CleanupStack::PushL(entry);
	
	CMsvStore* store = entry->ReadStoreL();
	CleanupStack::PushL(store);
	
	MMsvAttachmentManager& manager = store->AttachmentManagerL();
	
	RFile fileAttachment = manager.GetAttachmentFileL(attachIndex);
	CleanupClosePushL(fileAttachment);
	
	if( dataFilePath != NULL )
		{
		// check of contents of attachment file is requested
		CompareFileL(fileAttachment, *dataFilePath);
		}
	
	CleanupStack::PopAndDestroy(3, entry); // fileAttachment, store, entry
	}
void CMtfTestActionSmtpGetAttachmentFileFromId::RunTestActionL()
	{
	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
	TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
	HBufC* dataFilePath   = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3), NULL);

	CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
	CleanupStack::PushL(entry);
	
	CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry);
	CleanupStack::PushL(emailMsg);
	
	MMsvAttachmentManager& manager = emailMsg->AttachmentManager();
	
	RFile fileAttachment = manager.GetAttachmentFileL(attachId);
	CleanupClosePushL(fileAttachment);
	
	if( dataFilePath != NULL )
		{
		// check of contents of attachment file is requested
		CompareFileL(fileAttachment, *dataFilePath);
		}
	
	CleanupStack::PopAndDestroy(3, entry); // fileAttachment, emailMsg, entry
	}
void CMtfTestActionCompareAttachment::ExecuteActionL()
	{
	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCompareAttachment);
	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
	TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
	TMsvAttachmentId attachId = ObtainValueParameterL<TMsvAttachmentId>(TestCase(),ActionParameters().Parameter(2));
	HBufC* dataFilePath   = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(3));

	CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
	CleanupStack::PushL(entry);
	
	CMsvStore* store = entry->ReadStoreL();
	CleanupStack::PushL(store);
	
	MMsvAttachmentManager& manager = store->AttachmentManagerL();
	
	RFile fileAttachment = manager.GetAttachmentFileL(attachId);
	CleanupClosePushL(fileAttachment);
	
	CompareFileL(fileAttachment, *dataFilePath);
	
	CleanupStack::PopAndDestroy(&fileAttachment);
	
	CleanupStack::PopAndDestroy(2, entry); // store, entry
	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCompareAttachment);
	TestCase().ActionCompletedL(*this);
	}
// Tokenize the property list taken from ini file and compare each of them with the expected one
void CTestCompareCntFiles::TokenizeAndCompareL()
	{
	RArray<TPtrC>	fieldList;
	CleanupClosePushL(fieldList);
	iExportObj->TokenizeStringL(iFieldToVerify, fieldList);
	
	TInt count = fieldList.Count();
	TBuf8<KMaxLengthField> property;
	
	for(TInt i = 0;i < count;i++)
		{	
		property.Copy(fieldList[i]);
		CompareFileL(iExpectedExportFilePath, iExportFilePath, property);
		}
	CleanupStack::PopAndDestroy();
	fieldList.Close();
	}