uiservicetab/vimpstengine/tsrc/vimpstengine_ut/src/t_vimpstenginerequestmapper.cpp
branchRCL_3
changeset 23 9a48e301e94b
parent 0 5e5d6b214f4f
child 24 2b4be3554d30
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiservicetab/vimpstengine/tsrc/vimpstengine_ut/src/t_vimpstenginerequestmapper.cpp	Wed Sep 01 12:33:36 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* t_vimpstenginerequestmapper.cpp :: Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: t_vimpstenginerequestmapper.cpp
+*
+*/
+#include <EUnitMacros.h>
+#include <TEUnitAssertionInfo.h>
+#include <CEUnitAllocTestCaseDecorator.h>
+#include "t_vimpstenginerequestmapper.h"
+#include "cvimpstenginerequestmapper.h"
+#include "cvimpstenginerequest.h"
+
+extern TXIMPRequestId gTXIMPRequestId;
+
+T_VIMPSTEngineRequestMapper* T_VIMPSTEngineRequestMapper::NewLC()
+    {
+    T_VIMPSTEngineRequestMapper* self = new( ELeave ) T_VIMPSTEngineRequestMapper;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+T_VIMPSTEngineRequestMapper::~T_VIMPSTEngineRequestMapper()
+    {
+    }
+
+void T_VIMPSTEngineRequestMapper::ConstructL()
+    {
+    CEUnitTestSuiteClass::ConstructL();
+    }
+
+        
+void T_VIMPSTEngineRequestMapper::SetupL()
+    {   
+    iRequestMapper = CVIMPSTEngineRequestMapper::NewL() ;
+    }    
+
+void T_VIMPSTEngineRequestMapper::Teardown()
+    {
+    delete iRequestMapper;
+    }
+
+
+void T_VIMPSTEngineRequestMapper::TestAllFunctionsL()
+    {
+    
+    //Do all the functions here.. 
+    gTXIMPRequestId.Init(1000);  
+    
+    CVIMPSTEngineRequest* req1 = iRequestMapper->FindRequestId(gTXIMPRequestId);    
+    EUNIT_ASSERT(NULL == req1);
+    req1 = NULL;
+    
+    // remove the request mapper
+    iRequestMapper->RemoveRequestId(gTXIMPRequestId);
+   
+    
+    CVIMPSTEngineRequest* req3 = iRequestMapper->CreateRequestL(gTXIMPRequestId, 
+										ETrue,
+										EVIMPSTXimpOperationBind) ;
+	EUNIT_ASSERT(req3);									
+	EUNIT_ASSERT(EVIMPSTXimpOperationBind == req3->RequestType());
+	req3 = NULL;
+											
+	iRequestMapper->RemoveRequestId(gTXIMPRequestId) ;	
+	
+	gTXIMPRequestId.Init(2000);  
+	CVIMPSTEngineRequest* req5 = iRequestMapper->CreateRequestL(gTXIMPRequestId, 
+										EFalse,
+										EVIMPSTXimpOperationUnBind) ;
+	EUNIT_ASSERT(req5);									
+	EUNIT_ASSERT(EVIMPSTXimpOperationUnBind == req5->RequestType());
+	req5 = NULL;
+	
+	CVIMPSTEngineRequest* req7 = iRequestMapper->FindRequestId(gTXIMPRequestId);    
+    EUNIT_ASSERT(req7);
+    EUNIT_ASSERT(EVIMPSTXimpOperationUnBind == req7->RequestType());
+    req7 = NULL;
+    										
+	iRequestMapper->RemoveRequestId(gTXIMPRequestId) ;	
+    }
+
+
+EUNIT_BEGIN_TEST_TABLE( T_VIMPSTEngineRequestMapper, "T_VIMPSTEngineRequestMapper", "" )
+
+    EUNIT_TEST( "TestAllFunctionsL ",
+            "T_VIMPSTEngineRequestMapper",
+            "TestAllFunctionsL",
+            "FUNCTIONALITY", SetupL, TestAllFunctionsL, Teardown )
+    
+EUNIT_END_TESTCASE_TABLE
+
+//  END OF FILE