websrv_pub/xml_extensions_api/tsrc/senxml/src/senxmlcases.cpp
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:        ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 // INCLUDE FILES
       
    27 #include <StifTestModule.h>
       
    28 #include <e32math.h>
       
    29 #include <libc/assert.h>
       
    30 #include <e32panic.h>
       
    31 #include "SenXmlBCTest.h"
       
    32 #include "TestXml.h"
       
    33 
       
    34 // ============================ MEMBER FUNCTIONS ===============================
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // CSenUtilsBCTest::Case
       
    38 // Returns a test case by number.
       
    39 //
       
    40 // This function contains an array of all available test cases 
       
    41 // i.e pair of case name and test function. If case specified by parameter
       
    42 // aCaseNumber is found from array, then that item is returned.
       
    43 // 
       
    44 // The reason for this rather complicated function is to specify all the
       
    45 // test cases only in one place. It is not necessary to understand how
       
    46 // function pointers to class member functions works when adding new test
       
    47 // cases. See function body for instructions how to add new test case.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 const TCaseInfo CSenXmlBCTest::Case ( 
       
    51     const TInt aCaseNumber ) const 
       
    52      {
       
    53 
       
    54     /**
       
    55     * To add new test cases, implement new test case function and add new 
       
    56     * line to KCases array specify the name of the case and the function 
       
    57     * doing the test case
       
    58     * In practice, do following
       
    59     * 1) Make copy of existing test case function and change its name
       
    60     *    and functionality. Note that the function must be added to 
       
    61     *    SenUtils.cpp file and to SenUtils.h 
       
    62     *    header file.
       
    63     *
       
    64     * 2) Add entry to following KCases array either by using:
       
    65     *
       
    66     * 2.1: FUNCENTRY or ENTRY macro
       
    67     * ENTRY macro takes two parameters: test case name and test case 
       
    68     * function name.
       
    69     *
       
    70     * FUNCENTRY macro takes only test case function name as a parameter and
       
    71     * uses that as a test case name and test case function name.
       
    72     *
       
    73     * Or
       
    74     *
       
    75     * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
       
    76     * only with OOM (Out-Of-Memory) testing!
       
    77     *
       
    78     * OOM_ENTRY macro takes five parameters: test case name, test case 
       
    79     * function name, TBool which specifies is method supposed to be run using
       
    80     * OOM conditions, TInt value for first heap memory allocation failure and 
       
    81     * TInt value for last heap memory allocation failure.
       
    82     * 
       
    83     * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
       
    84     * that as a test case name, TBool which specifies is method supposed to be
       
    85     * run using OOM conditions, TInt value for first heap memory allocation 
       
    86     * failure and TInt value for last heap memory allocation failure. 
       
    87     */ 
       
    88 
       
    89     static TCaseInfoInternal const KCases[] =
       
    90         {
       
    91         //  TEST TABLE
       
    92 		ENTRY("NewL - CSenBaseAttribute ", CSenXmlBCTest::CSenBaseAttribute_NewLL),
       
    93 		ENTRY("NewL - CSenBaseAttribute ", CSenXmlBCTest::CSenBaseAttribute_NewL_1L),
       
    94 		ENTRY("NewL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NewLL),
       
    95 		ENTRY("NewL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NewL_1L),
       
    96 		ENTRY("NewL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NewL_2L),
       
    97 		ENTRY("NewL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NewL_3L),
       
    98 		ENTRY("NewL - CSenBaseElement", CSenXmlBCTest::CSenBaseElement_NewL_4L),
       
    99 		ENTRY("SetAttributesL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetAttributesLL),
       
   100 		ENTRY("LocalName - CSenBaseElement ",CSenXmlBCTest::CSenBaseElement_LocalNameL),
       
   101 		ENTRY("NamespaceURI - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NamespaceURIL),
       
   102 		ENTRY("NsPrefix - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NsPrefixL),
       
   103 		ENTRY("SetPrefixL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetPrefixLL),
       
   104 		ENTRY("HasContentTrue - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_HasContentTL),
       
   105 		ENTRY("HasContentFalse - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_HasContentFL),
       
   106 
       
   107 		ENTRY("Content - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ContentL),
       
   108     
       
   109 		ENTRY("ContentNull - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_Content_NullL),
       
   110 
       
   111 		ENTRY("ContentUnicodeL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ContentUnicodeLL),
       
   112 
       
   113 		ENTRY("SetContentL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetContentLL),
       
   114 
       
   115 		ENTRY("SetContentNullL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetContentL_NullL),
       
   116     
       
   117 		ENTRY("SetContentoverrightL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetContentL_OverRightL),
       
   118     
       
   119 		ENTRY("SetContentEscCharL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetContentL_WithEscCharsL),
       
   120 
       
   121 		ENTRY("ConsistsOfL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ConsistsOfLL),
       
   122 
       
   123 		ENTRY("SetNamespaceL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceLL),
       
   124     
       
   125 		ENTRY("SetNamespaceNullL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceL_NullL),
       
   126 
       
   127 		ENTRY("SetNamespaceL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceL_1L),
       
   128 
       
   129 		ENTRY("SetNamespace2SameL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceL_2same1L),
       
   130     
       
   131 		ENTRY("SetNamespace2DiffL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceL_2Diff1L),
       
   132     
       
   133 		ENTRY("SetNamespaceDPSUL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceL_DPSU1L),       
       
   134     
       
   135 		ENTRY("SetNamespaceSameNsforPC1L - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetNamespaceL_SNsPC1L),           
       
   136 
       
   137 		ENTRY("AddNamespace_FalseL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_FL),
       
   138     
       
   139 		ENTRY("AddNamespace_TrueL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_TL),    
       
   140     
       
   141 		ENTRY("AddNamespace_TrueSameParentNSL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_TSPL),      
       
   142     
       
   143 		ENTRY("AddNamespace_TrueDiffParentNSL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_TDPL),          
       
   144 
       
   145 		ENTRY("AddNamespaceL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_1L),
       
   146 
       
   147 		ENTRY("AddNamespace2SameL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_2same1L),
       
   148     
       
   149 		ENTRY("AddNamespace2DiffL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddNamespaceL_2Diff1L),
       
   150     
       
   151 		ENTRY("Namespace - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NamespaceL),
       
   152     
       
   153 
       
   154 		ENTRY("Namespace - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_Namespace_1L),
       
   155     
       
   156 		ENTRY("Namespace_with parent1 - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_Namespace_WP1L),
       
   157 
       
   158 		ENTRY("Namespace - test2 - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_Namespace_2L),
       
   159     
       
   160 		ENTRY("Namespace - test3 - CSenBaseElement", CSenXmlBCTest::CSenBaseElement_Namespace_3L),
       
   161 
       
   162 		ENTRY("ElementsL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ElementsLL),
       
   163 
       
   164 		ENTRY("AttributesL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AttributesLL),
       
   165 
       
   166 		ENTRY("NamespacesL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_NamespacesLL),
       
   167 
       
   168 		ENTRY("AttrValue - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AttrValueL),
       
   169 
       
   170 		ENTRY("AddAttrL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddAttrLL),
       
   171 
       
   172 		ENTRY("AddAttributeL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddAttributeLL),		
       
   173 		ENTRY("Parent - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ParentL),
       
   174 
       
   175 		ENTRY("SetParent - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetParentL),
       
   176 
       
   177 		ENTRY("Root - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_RootL),
       
   178 
       
   179 		ENTRY("Element - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ElementL),
       
   180 		ENTRY("Elements1 - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ElementsL1),
       
   181 		ENTRY("Elements2 - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ElementsL2),
       
   182 
       
   183 		ENTRY("CreateElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_CreateElementLL),
       
   184 
       
   185 		ENTRY("InsertElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_InsertElementLL),
       
   186     
       
   187 		ENTRY("InsertElement_No_BeforeElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_InsertElementL_NoBeforeL),
       
   188 
       
   189 		ENTRY("AddElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddElementLL),
       
   190 
       
   191 		ENTRY("AddElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddElementL_1L),
       
   192 
       
   193 		ENTRY("AddElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddElementL_2L),
       
   194 
       
   195 		ENTRY("AddElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddElementL_3L),
       
   196 
       
   197 		ENTRY("RemoveElement - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_RemoveElementL),
       
   198 
       
   199 		ENTRY("RemoveElement - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_RemoveElement_1L),
       
   200 
       
   201 		ENTRY("RemoveElement - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_RemoveElement_2L),
       
   202 
       
   203 		ENTRY("ReplaceElementL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ReplaceElementLL),
       
   204 
       
   205 		ENTRY("AsXmlL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AsXmlLL),
       
   206 
       
   207 		ENTRY("AsXmlUnicodeL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AsXmlUnicodeLL),
       
   208 
       
   209 		ENTRY("CopyFromL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_CopyFromLL),
       
   210 
       
   211 		ENTRY("DetachL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_DetachLL),
       
   212 
       
   213 		ENTRY("Child - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ChildL),
       
   214 
       
   215 		ENTRY("Set - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_SetL),
       
   216     
       
   217 		ENTRY("AddAttributesL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AddAttributesLL),
       
   218 
       
   219 		ENTRY("AsElement - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_AsElementL),
       
   220 
       
   221 		ENTRY("ContentWriteStreamL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_ContentWriteStreamLL),
       
   222     
       
   223 		ENTRY("RemoveAttributeL - CSenBaseElement ", CSenXmlBCTest::CSenBaseElement_RemoveAttributeLL),
       
   224 
       
   225 		ENTRY("NewL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NewLL),
       
   226 
       
   227 		ENTRY("NewL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NewL_1L),
       
   228 
       
   229 		ENTRY("NewL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NewL_2L),
       
   230 
       
   231 		ENTRY("SetAttributesL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetAttributesLL),
       
   232 
       
   233 		ENTRY("LocalName - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_LocalNameL),
       
   234 
       
   235 		ENTRY("NamespaceURI - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NamespaceURIL),
       
   236 
       
   237 		ENTRY("NsPrefix - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NsPrefixL),
       
   238 
       
   239 		ENTRY("SetPrefixL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetPrefixLL),
       
   240 
       
   241 		ENTRY("HasContent - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_HasContentL),
       
   242 
       
   243 		ENTRY("Content - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ContentL),
       
   244 		
       
   245 		ENTRY("ContentWriteStreamL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ContentWriteStreamLL),
       
   246 		
       
   247 
       
   248 		ENTRY("ContentUnicodeL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ContentUnicodeLL),
       
   249 
       
   250 		ENTRY("SetContentL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetContentLL),
       
   251 
       
   252 		ENTRY("ConsistsOfL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ConsistsOfLL),
       
   253     
       
   254 		ENTRY("ConsistsOfL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ConsistsOfL1L),
       
   255     
       
   256 		ENTRY("ConsistsOfL - Extratest CSenXmlElement", CSenXmlBCTest::CSenXmlElement_ConsistsOfL1L),
       
   257 
       
   258 		ENTRY("SetNamespaceL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetNamespaceLL),
       
   259 
       
   260 		ENTRY("SetNamespaceL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetNamespaceL_1L),
       
   261     
       
   262 		ENTRY("SetNamespaceL - Sametest CSenXmlElement", CSenXmlBCTest::CSenXmlElement_SetNamespaceL_2same1L),
       
   263 
       
   264 		ENTRY("SetNamespaceL - Difftest CSenXmlElement", CSenXmlBCTest::CSenXmlElement_SetNamespaceL_2Diff1L),
       
   265 
       
   266 		ENTRY("AddNamespaceL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddNamespaceLL),
       
   267 
       
   268 		ENTRY("AddNamespaceL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddNamespaceL_1L),
       
   269 
       
   270 		ENTRY("Namespace - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NamespaceL),
       
   271 
       
   272 		ENTRY("Namespace - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_Namespace_1L),
       
   273 
       
   274 		ENTRY("Namespace - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_Namespace_2L),
       
   275 
       
   276 		ENTRY("Namespace - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_Namespace_3L),
       
   277 
       
   278 		ENTRY("ElementsL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ElementsLL),
       
   279 
       
   280 		ENTRY("AttributesL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AttributesLL),
       
   281 		ENTRY("AttributeLL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddAttributeLL),
       
   282 
       
   283 		ENTRY("NamespacesL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_NamespacesLL),
       
   284 
       
   285 		ENTRY("AttrValue - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AttrValueL),
       
   286 
       
   287 		ENTRY("AddAttrL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddAttrLL),
       
   288 
       
   289 		ENTRY("Parent - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ParentL),
       
   290 
       
   291 		ENTRY("SetParent - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetParentL),
       
   292 
       
   293 		ENTRY("Root - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_RootL),
       
   294 
       
   295 		ENTRY("Element - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ElementL),
       
   296 
       
   297 		ENTRY("CreateElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_CreateElementLL),
       
   298 
       
   299 		ENTRY("InsertElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_InsertElementLL),
       
   300 
       
   301 		ENTRY("AddElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddElementLL),
       
   302 
       
   303 		ENTRY("AddElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddElementL_1L),
       
   304 
       
   305 		ENTRY("AddElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddElementL_2L),
       
   306 
       
   307 		ENTRY("AddElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddElementL_3L),
       
   308 
       
   309 		ENTRY("RemoveElement - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_RemoveElementL),
       
   310 
       
   311 		ENTRY("RemoveElement - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_RemoveElement_1L),
       
   312 
       
   313 		ENTRY("RemoveElement - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_RemoveElement_2L),
       
   314 
       
   315 		ENTRY("ReplaceElementL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ReplaceElementLL),
       
   316 
       
   317 		ENTRY("AsXmlL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AsXmlLL),
       
   318 
       
   319 		ENTRY("AsXmlUnicodeL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AsXmlUnicodeLL),
       
   320 
       
   321 		ENTRY("CopyFromL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_CopyFromLL),
       
   322 
       
   323 		ENTRY("DetachL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_DetachLL),
       
   324 
       
   325 		ENTRY("Child - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_ChildL),
       
   326 
       
   327 		ENTRY("Set - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_SetL),
       
   328 
       
   329 		ENTRY("AddAttributesL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AddAttributesLL),
       
   330 /*    
       
   331 		ENTRY("RemoveAttributeL - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_RemoveAttributeLL),
       
   332 */    
       
   333 		ENTRY("AsElement - CSenXmlElement ", CSenXmlBCTest::CSenXmlElement_AsElementL),
       
   334     
       
   335 		ENTRY("NewL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NewL_L),
       
   336     
       
   337 		ENTRY("NewL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NewL_1L),
       
   338     
       
   339 		ENTRY("NewL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NewL_2L),
       
   340     
       
   341 		ENTRY("NewL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NewL_3L),
       
   342     
       
   343 		ENTRY("NewL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NewL_4L),
       
   344     
       
   345 		ENTRY("NewL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NewL_5L),
       
   346 
       
   347 		ENTRY("AsXmlUnicodeL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_AsXmlUnicodeLL),
       
   348 
       
   349 		ENTRY("WriteAsXMLToL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_WriteAsXMLToLL),
       
   350     
       
   351     	ENTRY("Content - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ContentL),
       
   352     	ENTRY("Namespace - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NamespaceL),
       
   353     	ENTRY("EnsureNamespace - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_EnsureNamespaceL),
       
   354     	ENTRY("DetachL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_DetachLL),
       
   355 		ENTRY("SaveNamespacesLL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_SaveNamespacesLL),
       
   356 		ENTRY("ResetContentLL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ResetContentLL),
       
   357 		ENTRY("LocalNameL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_LocalNameL),
       
   358 		ENTRY("NsUriL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NsUriL),
       
   359 		ENTRY("NsPrefixL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_NsPrefixL),
       
   360 		ENTRY("ExtractElementL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ExtractElementL),
       
   361 		ENTRY("SetAttributesL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_SetAttributesLL),
       
   362 		ENTRY("ConsistsOfL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ConsistsOfLL),
       
   363 		ENTRY("ParseL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ParseLL),
       
   364 		ENTRY("ErrorParseL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ParseL1L),
       
   365 		ENTRY("SetContentOfL- CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_SetContentOfLL),
       
   366 		ENTRY("ContentOf- CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_ContentOfL),
       
   367 		ENTRY("ParserFeature - CSenXMLReader", CSenXmlBCTest::CSenXMLReader_ParserFeatureL),
       
   368 		ENTRY("ParseL - CSenXMLReader", CSenXmlBCTest::CSenXMLReader_ParseLL),
       
   369 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_1L),
       
   370 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_L),
       
   371 
       
   372 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_2L),
       
   373 
       
   374 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_3L),
       
   375 
       
   376 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_4L),
       
   377 
       
   378 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_5L),
       
   379 
       
   380 		ENTRY("NewL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_NewL_6L),
       
   381 
       
   382 		//ENTRY("ExpandL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_ExpandLL),
       
   383 		
       
   384 		//ENTRY("ResumeParsingFromL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_ResumeParsingFromLL),
       
   385 		
       
   386 		ENTRY("ParseWithL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_ParseWithLL),
       
   387 
       
   388 
       
   389 		ENTRY("SetAttributesL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_SetAttributesLL),
       
   390 
       
   391 		ENTRY("ParseL1 - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_ParseL1L),
       
   392 
       
   393 		ENTRY("NewL - CSenNamespace ", CSenXmlBCTest::CSenNamespace_NewL_L),    
       
   394     
       
   395 		ENTRY("NewLC - CSenNamespace ", CSenXmlBCTest::CSenNamespace_NewLC_L),
       
   396 
       
   397 		ENTRY("NewL - CSenNamespace ", CSenXmlBCTest::CSenNamespace_NewL_1L),
       
   398 
       
   399 		ENTRY("NewLC - CSenNamespace ", CSenXmlBCTest::CSenNamespace_NewLC_1L),
       
   400     
       
   401 		ENTRY("MatchesL - CSenNamespace ", CSenXmlBCTest::CSenNamespace_MatchesL_L),
       
   402 		
       
   403 		ENTRY("InsertL - CSenNamespace ", CSenXmlBCTest::CSenNamespace_InsertLL),
       
   404 		
       
   405     
       
   406 		ENTRY("NewL - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewL_L),
       
   407   
       
   408 		ENTRY("NewLC - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewLC_L),
       
   409     
       
   410 		ENTRY("NewL - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewL_1L),
       
   411     
       
   412 		ENTRY("NewLC - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewLC_1L),
       
   413     
       
   414 		ENTRY("NewL - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewL_2L),
       
   415     
       
   416 		ENTRY("NewLC - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewLC_2L),
       
   417     
       
   418 		ENTRY("NewL - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewL_3L),
       
   419     
       
   420 		ENTRY("NewLC - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_NewLC_3L),
       
   421 
       
   422 		ENTRY("EnabledParserFeature - CSenXmlReader ", CSenXmlBCTest::CSenXmlReader_EnabledParserFeature_L),
       
   423 		
       
   424 		ENTRY("ToUtf8LC - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_ToUtf8LCL),
       
   425 		
       
   426 		ENTRY("StartsWith - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_StartsWithL),
       
   427 
       
   428 		ENTRY("EndsWith - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_EndsWithL),
       
   429 
       
   430 		ENTRY("AttrValue - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_AttrValueL),
       
   431 
       
   432 		ENTRY("AllocAttrValueL - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_AllocAttrValueLL),
       
   433 
       
   434 		ENTRY("DecodeHttpCharactersL - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_DecodeHttpCharactersLL),
       
   435 
       
   436 		ENTRY("DecodeHttpCharactersLC - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_DecodeHttpCharactersLCL),
       
   437 
       
   438 		ENTRY("NsPrefix - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_NsPrefixL),
       
   439 
       
   440 		ENTRY("LocalName - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_LocalNameL),
       
   441 
       
   442 		ENTRY("RemoveAttributeL - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_RemoveAttributeLL),
       
   443 
       
   444 		ENTRY("RemoveAttributeL1 - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_RemoveAttributeL1L),
       
   445 
       
   446 		ENTRY("AddAttributeL - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_AddAttributeLL),
       
   447 
       
   448 		ENTRY("AddAttributeL1 - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_AddAttributeL1L),
       
   449 
       
   450 		ENTRY("AddAttributeL1 - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_AddAttributeL2L),
       
   451 		
       
   452 		ENTRY("EncodeHttpCharactersLC - CSenXmlUtils ", CSenXmlBCTest::CSenXmlUtils_EncodeHttpCharactersLCL),
       
   453 		ENTRY("BaseConstructL - CSenDomFragment ", CSenXmlBCTest::CSenDomFragment_BaseConstructL),
       
   454 		ENTRY("BaseConstructL - CSenBaseFragment ", CSenXmlBCTest::CSenBaseFragment_BaseConstructL),
       
   455 		
       
   456     
       
   457         // Example how to use OOM functionality
       
   458         //OOM_ENTRY( "Loop test with OOM", CSenUtilsBCTest::LoopTest, ETrue, 2, 3),
       
   459         //OOM_FUNCENTRY( CSenUtilsBCTest::PrintTest, ETrue, 1, 3 ),
       
   460         };
       
   461 
       
   462     // Verify that case number is valid
       
   463     if( (TUint) aCaseNumber >= sizeof( KCases ) / 
       
   464                                sizeof( TCaseInfoInternal ) )
       
   465         {
       
   466         // Invalid case, construct empty object
       
   467         TCaseInfo null( (const TText*) L"" );
       
   468         null.iMethod = 0 ;
       
   469         null.iIsOOMTest = EFalse;
       
   470         null.iFirstMemoryAllocation = 0;
       
   471         null.iLastMemoryAllocation = 0;
       
   472         return null;
       
   473         } 
       
   474 
       
   475     // Construct TCaseInfo object and return it
       
   476     TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
       
   477     tmp.iMethod = KCases[ aCaseNumber ].iMethod;
       
   478     tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
       
   479     tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
       
   480     tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
       
   481     return tmp;
       
   482 
       
   483     }
       
   484 
       
   485 void CSenXmlBCTest::SetupL(  ){
       
   486     if ( iXmlReader ){
       
   487         delete iXmlReader;
       
   488         iXmlReader = NULL;
       
   489     }
       
   490     iXmlReader = CSenXmlReader::NewL(
       
   491     );
       
   492 } 
       
   493 
       
   494 void CSenXmlBCTest::Teardown(  ){
       
   495     if ( iXmlReader){
       
   496         delete iXmlReader;
       
   497         iXmlReader = NULL;
       
   498     }
       
   499 }
       
   500 
       
   501 TInt CSenXmlBCTest::CSenBaseAttribute_NewLL (TTestResult& aResult)
       
   502     {
       
   503     SetupL();
       
   504     TBool Flag;
       
   505     CSenBaseAttribute* pAttr=CSenBaseAttribute::NewL(_L8("Attr1"),_L8("value"));
       
   506     CleanupStack::PushL(pAttr);
       
   507     if(pAttr)
       
   508     	Flag=1;
       
   509     else
       
   510     	Flag=0;
       
   511         /*EUNIT_ASSERT( Flag );*/
       
   512     if(!Flag)
       
   513     return KErrArgument;   
       
   514 
       
   515     CleanupStack::PopAndDestroy(pAttr);
       
   516     Teardown();
       
   517     return KErrNone;
       
   518     }
       
   519 
       
   520 TInt CSenXmlBCTest::CSenBaseAttribute_NewL_1L (TTestResult& aResult)
       
   521     {
       
   522     SetupL();    
       
   523     TBool Flag;
       
   524     CSenBaseAttribute* pAttr=CSenBaseAttribute::NewL(_L8("N:Attr1"),_L8("Attr1"),_L8("value"));
       
   525     CleanupStack::PushL(pAttr);
       
   526     if(pAttr)
       
   527     	Flag=1;
       
   528     else
       
   529     	Flag=0;
       
   530         /*EUNIT_ASSERT( Flag );*/
       
   531     if(!Flag)
       
   532     return KErrArgument;   
       
   533 
       
   534     CleanupStack::PopAndDestroy(pAttr);
       
   535     Teardown();
       
   536     return KErrNone;
       
   537     }
       
   538 
       
   539 TInt CSenXmlBCTest::CSenBaseElement_NewLL (TTestResult& aResult)
       
   540     {
       
   541     SetupL();
       
   542     TBool Flag;
       
   543     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
   544     CleanupStack::PushL(pElement);
       
   545     if(pElement!=NULL)
       
   546     	Flag=1;
       
   547     else
       
   548     	Flag=0;
       
   549         /*EUNIT_ASSERT( Flag );*/
       
   550     if(!Flag)
       
   551     return KErrArgument;   
       
   552 
       
   553     CleanupStack::PopAndDestroy(pElement);
       
   554     Teardown();
       
   555     return KErrNone;
       
   556     }
       
   557 
       
   558 TInt CSenXmlBCTest::CSenBaseElement_NewL_1L (TTestResult& aResult)
       
   559     {
       
   560     SetupL();
       
   561     TBool Flag;
       
   562     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"));
       
   563     CleanupStack::PushL(pElement);
       
   564     if(pElement!=NULL)
       
   565     	Flag=1;
       
   566     else
       
   567     	Flag=0;
       
   568         /*EUNIT_ASSERT( Flag );*/
       
   569     if(!Flag)
       
   570     return KErrArgument;   
       
   571 
       
   572     CleanupStack::PopAndDestroy(pElement);
       
   573 	Teardown();
       
   574     return KErrNone;    
       
   575     }
       
   576 
       
   577 TInt CSenXmlBCTest::CSenBaseElement_NewL_2L (TTestResult& aResult)
       
   578     {
       
   579     SetupL();
       
   580     TBool Flag;
       
   581     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"));
       
   582     CleanupStack::PushL(pElement);
       
   583     if(pElement!=NULL)
       
   584     	Flag=1;
       
   585     else
       
   586     	Flag=0;
       
   587         /*EUNIT_ASSERT( Flag );*/
       
   588     if(!Flag)
       
   589     return KErrArgument;   
       
   590 
       
   591     CleanupStack::PopAndDestroy(pElement);
       
   592     Teardown();
       
   593     return KErrNone;
       
   594     }
       
   595     
       
   596 TInt CSenXmlBCTest::CSenBaseElement_NewL_3L (TTestResult& aResult)
       
   597     {
       
   598     SetupL();
       
   599     TBool Flag;
       
   600     RAttributeArray aAttrs;
       
   601     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs);
       
   602     CleanupStack::PushL(pElement);
       
   603     if(pElement!=NULL)
       
   604     	Flag=1;
       
   605     else
       
   606     	Flag=0;
       
   607         /*EUNIT_ASSERT( Flag );*/
       
   608     if(!Flag)
       
   609     return KErrArgument;   
       
   610 
       
   611     CleanupStack::PopAndDestroy(pElement);
       
   612     Teardown();
       
   613     return KErrNone;
       
   614     }
       
   615     
       
   616 TInt CSenXmlBCTest::CSenBaseElement_NewL_4L (TTestResult& aResult)
       
   617     {
       
   618     SetupL();
       
   619     TBool Flag;
       
   620     RAttributeArray aAttrs;
       
   621     CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia"));
       
   622     CleanupStack::PushL(ele);
       
   623     CSenElement* parent = ele->Parent();
       
   624     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs, *parent);
       
   625     CleanupStack::PushL(pElement);
       
   626     if(pElement!=NULL)
       
   627     	Flag=1;
       
   628     else
       
   629     	Flag=0;
       
   630         /*EUNIT_ASSERT( Flag );*/
       
   631     if(!Flag)
       
   632     return KErrArgument;   
       
   633 
       
   634     CleanupStack::PopAndDestroy(pElement);
       
   635     CleanupStack::PopAndDestroy(ele);
       
   636     Teardown();
       
   637     return KErrNone;
       
   638     }
       
   639 
       
   640 TInt CSenXmlBCTest::CSenBaseElement_SetAttributesLL (TTestResult& aResult)
       
   641     {
       
   642     SetupL();
       
   643     RStringPool stringPool;
       
   644     stringPool.OpenL();
       
   645     CleanupClosePushL(stringPool);
       
   646     
       
   647     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
   648     CleanupClosePushL(nsUriRString);
       
   649     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
   650     CleanupClosePushL(nsPrefixRString);
       
   651     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
   652     CleanupClosePushL(localNameRString);
       
   653     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
   654     CleanupClosePushL(valueRString);
       
   655     
       
   656     RAttribute attribute;
       
   657     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
   658                    valueRString);
       
   659     CleanupStack::Pop(4); 
       
   660     CleanupClosePushL(attribute);
       
   661 
       
   662     RAttributeArray attrArray;
       
   663     attrArray.AppendL(attribute);
       
   664     CleanupClosePushL(attrArray); 
       
   665       
       
   666     CSenBaseElement *pElement = CSenBaseElement::NewL(_L8("Nokia"));
       
   667     CleanupStack::PushL(pElement);
       
   668     pElement->SetAttributesL(attrArray);
       
   669     HBufC8* pElementBuf = pElement->AsXmlL();
       
   670     /*EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/
       
   671     if(!( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" )))
       
   672     return KErrArgument;   
       
   673 
       
   674 	CleanupStack::PopAndDestroy(pElement);
       
   675 	CleanupStack::PopAndDestroy(&attrArray);
       
   676     CleanupStack::PopAndDestroy(&attribute);
       
   677     CleanupStack::PopAndDestroy(&stringPool);
       
   678 	delete pElementBuf;
       
   679     Teardown();
       
   680     return KErrNone;
       
   681     }
       
   682 
       
   683 TInt CSenXmlBCTest::CSenBaseElement_LocalNameL (TTestResult& aResult)
       
   684     {
       
   685     SetupL();
       
   686     TBool Flag;
       
   687     _LIT8(KLName,"Nokia");
       
   688  
       
   689     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
   690     CleanupStack::PushL(pElement);
       
   691     const TDesC8& pLName=pElement->LocalName(); 
       
   692     if(pLName==_L8("Nokia"))
       
   693 	 	Flag=1;
       
   694 	else
       
   695 		Flag=0;
       
   696 /*    EUNIT_ASSERT(Flag);*/
       
   697     if(!Flag)
       
   698     return KErrArgument;
       
   699     
       
   700 	CleanupStack::PopAndDestroy(pElement);
       
   701     Teardown();
       
   702     return KErrNone;
       
   703     }
       
   704 
       
   705 TInt CSenXmlBCTest::CSenBaseElement_NamespaceURIL (TTestResult& aResult)
       
   706     {
       
   707     SetupL();
       
   708     _LIT8(KNSUri,"nsuria");
       
   709     TBool Flag;
       
   710     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"));
       
   711     CleanupStack::PushL(pElement);
       
   712     const TDesC8 &pNSUri=pElement->NamespaceURI();
       
   713     if(pNSUri==KNSUri)
       
   714     	Flag=1;
       
   715     else
       
   716     	Flag=0;
       
   717     CleanupStack::PopAndDestroy(pElement);
       
   718         /*EUNIT_ASSERT( Flag );*/
       
   719     if(!Flag)
       
   720     return KErrArgument;   
       
   721 
       
   722     Teardown();
       
   723     return KErrNone;
       
   724     }
       
   725 
       
   726 TInt CSenXmlBCTest::CSenBaseElement_NsPrefixL (TTestResult& aResult)
       
   727     {
       
   728     SetupL();
       
   729     TBool Flag;
       
   730     _LIT8(KNSPrefix,"N");
       
   731     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   732     const TDesC8& pNSPrefix=pElement->NsPrefix();
       
   733     if(pNSPrefix==KNSPrefix)
       
   734     	Flag=1;
       
   735     else
       
   736     	Flag=0;
       
   737     delete pElement;    
       
   738         /*EUNIT_ASSERT( Flag );*/
       
   739     if(!Flag)
       
   740     return KErrArgument;   
       
   741 
       
   742     Teardown();
       
   743     return KErrNone;
       
   744     }
       
   745 
       
   746 TInt CSenXmlBCTest::CSenBaseElement_SetPrefixLL (TTestResult& aResult)
       
   747     {
       
   748     SetupL();
       
   749     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"));
       
   750     CleanupStack::PushL(pElement);
       
   751 	pElement->SetPrefixL(_L8("N"));
       
   752 	const TDesC8& pNSPrefix=pElement->NsPrefix();
       
   753     /*EUNIT_ASSERT_EQUALS(pNSPrefix, _L8("N"));*/
       
   754     TL(pNSPrefix == _L8("N"));
       
   755     CleanupStack::PopAndDestroy(pElement);
       
   756     Teardown();
       
   757     return KErrNone;
       
   758     }
       
   759 
       
   760 TInt CSenXmlBCTest::CSenBaseElement_HasContentTL (TTestResult& aResult)
       
   761     {
       
   762     SetupL();	
       
   763     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   764 	pElement->SetContentL(_L8("Nokia content"));
       
   765 	TBool Flag=pElement->HasContent();
       
   766         /*EUNIT_ASSERT( Flag );*/
       
   767     if(!Flag)
       
   768     return KErrArgument;   
       
   769 
       
   770     delete pElement;
       
   771     Teardown();
       
   772     return KErrNone;
       
   773     }
       
   774     
       
   775 TInt CSenXmlBCTest::CSenBaseElement_HasContentFL (TTestResult& aResult)
       
   776     {
       
   777     SetupL();
       
   778     TBool Flag;
       
   779     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   780 	TBool pHasContnt=pElement->HasContent();
       
   781 	if(pHasContnt)
       
   782 		Flag=0;
       
   783 	else
       
   784 		Flag=1;
       
   785 	    /*EUNIT_ASSERT( Flag );*/
       
   786     if(!Flag)
       
   787     return KErrArgument;   
       
   788 
       
   789 	delete pElement;
       
   790     Teardown();
       
   791     return KErrNone;
       
   792     }    
       
   793 
       
   794 TInt CSenXmlBCTest::CSenBaseElement_ContentL (TTestResult& aResult)
       
   795     {
       
   796     SetupL();
       
   797     TBool Flag;
       
   798     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   799 	pElement->SetContentL(_L8("Nokia content"));
       
   800 	TPtrC8 pContent=pElement->Content();
       
   801 	if(pContent==_L8("Nokia content"))
       
   802 		Flag=1;
       
   803 	else
       
   804 		Flag=0;
       
   805 	
       
   806         /*EUNIT_ASSERT( Flag );*/
       
   807     if(!Flag)
       
   808     return KErrArgument;   
       
   809 
       
   810     delete pElement;
       
   811     Teardown();
       
   812     return KErrNone;
       
   813     }
       
   814 
       
   815 TInt CSenXmlBCTest::CSenBaseElement_Content_NullL (TTestResult& aResult)
       
   816     {
       
   817     SetupL();
       
   818     TBool Flag;
       
   819     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   820 	TPtrC8 pContent=pElement->Content();
       
   821 	if(pContent==KNullDesC8())
       
   822 		Flag=1;
       
   823 	else
       
   824 		Flag=0;
       
   825 	
       
   826         /*EUNIT_ASSERT( Flag );*/
       
   827     if(!Flag)
       
   828     return KErrArgument;   
       
   829 
       
   830    	delete pElement;
       
   831     Teardown();
       
   832     return KErrNone;
       
   833     }    
       
   834 
       
   835 TInt CSenXmlBCTest::CSenBaseElement_ContentUnicodeLL (TTestResult& aResult)
       
   836     {    
       
   837     SetupL();
       
   838     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   839     CleanupStack::PushL(pElement);
       
   840 	pElement->SetContentL(_L8("Nokia content"));
       
   841 	HBufC* ElementBuf=pElement->ContentUnicodeL();
       
   842 /*	EUNIT_ASSERT_EQUALS(*ElementBuf,_L("Nokia content"));*/
       
   843 	TL(*ElementBuf == _L("Nokia content"));
       
   844 	CleanupStack::PopAndDestroy(pElement);
       
   845 	delete ElementBuf;
       
   846     Teardown();
       
   847     return KErrNone;
       
   848     }
       
   849 
       
   850 TInt CSenXmlBCTest::CSenBaseElement_SetContentLL (TTestResult& aResult)
       
   851     {
       
   852     SetupL();
       
   853     TBool Flag;
       
   854     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   855     CleanupStack::PushL(pElement);
       
   856 	TPtrC8 pContent=pElement->SetContentL(_L8("Nokia Content"));
       
   857 	if(pContent==_L8("Nokia Content"))
       
   858 		Flag=1;
       
   859 	else
       
   860 		Flag=0;
       
   861         /*EUNIT_ASSERT( Flag );*/
       
   862     if(!Flag)
       
   863     return KErrArgument;   
       
   864 
       
   865     CleanupStack::PopAndDestroy(pElement);   
       
   866     Teardown();
       
   867     return KErrNone;
       
   868     }
       
   869     
       
   870 TInt CSenXmlBCTest::CSenBaseElement_SetContentL_NullL (TTestResult& aResult)
       
   871     {
       
   872     SetupL();
       
   873     TBool Flag;
       
   874     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   875     CleanupStack::PushL(pElement);
       
   876     pElement->SetContentL(_L8("element content"));
       
   877 	TPtrC8 pContent=pElement->SetContentL(KNullDesC8);
       
   878 	if(pContent==KNullDesC8())
       
   879 		Flag=1;
       
   880 	else
       
   881 		Flag=0;
       
   882         /*EUNIT_ASSERT( Flag );*/
       
   883     if(!Flag)
       
   884     return KErrArgument;   
       
   885 
       
   886     CleanupStack::PopAndDestroy(pElement);   
       
   887     Teardown();
       
   888     return KErrNone;
       
   889     }
       
   890     
       
   891 TInt CSenXmlBCTest::CSenBaseElement_SetContentL_OverRightL (TTestResult& aResult)
       
   892     {
       
   893     SetupL();
       
   894     TBool Flag;
       
   895     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   896     CleanupStack::PushL(pElement);
       
   897 	pElement->SetContentL(_L8("Nokia Content1"));
       
   898 	pElement->SetContentL(_L8("Nokia Content2"));	
       
   899 	TPtrC8 pContent=pElement->Content();
       
   900 	if(pContent==_L8("Nokia Content2"))
       
   901 		Flag=1;
       
   902 	else
       
   903 		Flag=0;
       
   904         /*EUNIT_ASSERT( Flag );*/
       
   905     if(!Flag)
       
   906     return KErrArgument;   
       
   907 
       
   908     CleanupStack::PopAndDestroy(pElement);   
       
   909     Teardown();
       
   910     return KErrNone;
       
   911     }
       
   912       
       
   913 TInt CSenXmlBCTest::CSenBaseElement_SetContentL_WithEscCharsL (TTestResult& aResult)
       
   914     {
       
   915     SetupL();
       
   916     TBool Flag;
       
   917     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
   918     CleanupStack::PushL(pElement);
       
   919 	TPtrC8 pContent=pElement->SetContentL(_L8("N&o'k\"ia <Content>"));
       
   920 	if(pContent==_L8("N&o'k\"ia <Content>"))
       
   921 		Flag=1;
       
   922 	else
       
   923 		Flag=0;
       
   924         /*EUNIT_ASSERT( Flag );*/
       
   925     if(!Flag)
       
   926     return KErrArgument;   
       
   927 
       
   928     CleanupStack::PopAndDestroy(pElement);   
       
   929     Teardown();
       
   930     return KErrNone;
       
   931     }      
       
   932        
       
   933 TInt CSenXmlBCTest::CSenBaseElement_ConsistsOfLL (TTestResult& aResult)
       
   934     {
       
   935     SetupL();
       
   936     CSenBaseElement* pElementA=CSenBaseElement::NewL(_L8("Nokia"));
       
   937     CleanupStack::PushL(pElementA);
       
   938     CSenBaseElement* pChild1A=CSenBaseElement::NewL(_L8("Asp"));
       
   939     CleanupStack::PushL(pChild1A);
       
   940     CSenBaseElement* pChild2A=CSenBaseElement::NewL(_L8("WebServices"));
       
   941     CleanupStack::PushL(pChild2A);
       
   942     pElementA->SetContentL(_L8("Nokia organisation structure"));
       
   943     pElementA->AddElementL(*pChild1A);
       
   944     pElementA->AddElementL(*pChild2A);
       
   945     
       
   946     CSenBaseElement* pElementB=CSenBaseElement::NewL(_L8("Nokia"));
       
   947     CleanupStack::PushL(pElementB);
       
   948     CSenBaseElement* pChild1B=CSenBaseElement::NewL(_L8("Asp"));
       
   949     CleanupStack::PushL(pChild1A);
       
   950     CSenBaseElement* pChild2B=CSenBaseElement::NewL(_L8("WebServices"));
       
   951     CleanupStack::PushL(pChild2B);
       
   952     pElementB->SetContentL(_L8("Nokia organisation structure"));
       
   953     pElementB->AddElementL(*pChild1B);
       
   954     pElementB->AddElementL(*pChild2B);
       
   955     
       
   956     TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA);
       
   957     /*EUNIT_ASSERT( ConsistOfFlag );*/
       
   958     if(!ConsistOfFlag)
       
   959     return KErrArgument;   
       
   960     
       
   961     CleanupStack::Pop(2);
       
   962     CleanupStack::PopAndDestroy(pElementB);
       
   963     CleanupStack::Pop(2);
       
   964     CleanupStack::PopAndDestroy(pElementA);
       
   965     Teardown();
       
   966     return KErrNone;
       
   967     }
       
   968 
       
   969 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceLL (TTestResult& aResult)
       
   970     {
       
   971     SetupL();
       
   972     TBool Flag;
       
   973     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
   974     CleanupStack::PushL(pElement);
       
   975     pElement->SetNamespaceL(_L8("namespaceuri"));
       
   976 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
   977 	if(pNsURI==_L8("namespaceuri"))
       
   978 		Flag=1;
       
   979 	else
       
   980 		Flag=0;
       
   981 	CleanupStack::PopAndDestroy(pElement);
       
   982         /*EUNIT_ASSERT( Flag );*/
       
   983     if(!Flag)
       
   984     return KErrArgument;   
       
   985 
       
   986     Teardown();
       
   987     return KErrNone;
       
   988     }
       
   989 
       
   990 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceL_NullL (TTestResult& aResult)
       
   991     {
       
   992     SetupL();
       
   993     TBool Flag;
       
   994     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
   995     CleanupStack::PushL(pElement);
       
   996     pElement->SetNamespaceL(_L8(""));
       
   997 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
   998 	if(pNsURI==_L8(""))
       
   999 		Flag=1;
       
  1000 	else
       
  1001 		Flag=0;
       
  1002 	CleanupStack::PopAndDestroy(pElement)	;
       
  1003         /*EUNIT_ASSERT( Flag );*/
       
  1004     if(!Flag)
       
  1005     return KErrArgument;   
       
  1006 
       
  1007     Teardown();
       
  1008     return KErrNone;
       
  1009     }
       
  1010 
       
  1011 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceL_1L (TTestResult& aResult)
       
  1012     {
       
  1013     SetupL();
       
  1014      TBool Flag;
       
  1015     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1016     CleanupStack::PushL(pElement);
       
  1017     pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1018 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  1019 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  1020 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1021 		Flag=1;
       
  1022 	else
       
  1023 		Flag=0;
       
  1024 	CleanupStack::PopAndDestroy(pElement);
       
  1025         /*EUNIT_ASSERT( Flag );*/
       
  1026     if(!Flag)
       
  1027     return KErrArgument;   
       
  1028 
       
  1029     Teardown();
       
  1030     return KErrNone;
       
  1031     }
       
  1032     
       
  1033 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceL_2same1L (TTestResult& aResult)
       
  1034     {
       
  1035     SetupL();
       
  1036      TBool Flag;
       
  1037     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1038     CleanupStack::PushL(pElement);
       
  1039     pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1040     pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1041 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  1042 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  1043 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1044 		Flag=1;
       
  1045 	else
       
  1046 		Flag=0;
       
  1047         /*EUNIT_ASSERT( Flag );*/
       
  1048     if(!Flag)
       
  1049     return KErrArgument;   
       
  1050 
       
  1051 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1052  	/*EUNIT_ASSERT( pNsList.Count()==1 );*/
       
  1053     if(!( pNsList.Count()==1 ))
       
  1054     return KErrArgument;   
       
  1055  	
       
  1056 	CleanupStack::PopAndDestroy(pElement); 
       
  1057     Teardown();
       
  1058     return KErrNone;
       
  1059     }    
       
  1060  
       
  1061 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceL_2Diff1L (TTestResult& aResult)
       
  1062     {
       
  1063     SetupL();
       
  1064      TBool Flag;
       
  1065     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1066     CleanupStack::PushL(pElement);
       
  1067     pElement->SetNamespaceL(_L8("N1"),_L8("namespaceuri1"));
       
  1068     pElement->SetNamespaceL(_L8("N2"),_L8("namespaceuri2"));
       
  1069 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  1070 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  1071 	if(pNsURI==_L8("namespaceuri2")&&pNsPrefix==_L8("N2"))
       
  1072 		Flag=1;
       
  1073 	else
       
  1074 		Flag=0;
       
  1075         /*EUNIT_ASSERT( Flag );*/
       
  1076     if(!Flag)
       
  1077     return KErrArgument;   
       
  1078 
       
  1079 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1080  	/*EUNIT_ASSERT( pNsList.Count()==2 );*/
       
  1081     if(!( pNsList.Count()==2 ))
       
  1082     return KErrArgument;   
       
  1083  	
       
  1084  	CleanupStack::PopAndDestroy(pElement);
       
  1085     Teardown();
       
  1086     return KErrNone;
       
  1087     }    
       
  1088  
       
  1089 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceL_DPSU1L (TTestResult& aResult)
       
  1090     {
       
  1091     SetupL();
       
  1092      TBool Flag;
       
  1093     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1094     CleanupStack::PushL(pElement);
       
  1095     pElement->SetNamespaceL(_L8("N1"),_L8("namespaceuri1"));
       
  1096     pElement->SetNamespaceL(_L8("N2"),_L8("namespaceuri1"));
       
  1097 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  1098 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  1099 	if(pNsURI==_L8("namespaceuri1")&&pNsPrefix==_L8("N2"))
       
  1100 		Flag=1;
       
  1101 	else
       
  1102 		Flag=0;
       
  1103         /*EUNIT_ASSERT( Flag );*/
       
  1104     if(!Flag)
       
  1105     return KErrArgument;   
       
  1106 
       
  1107 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1108  	/*EUNIT_ASSERT( pNsList.Count()==2 );*/
       
  1109     if(!( pNsList.Count()==2 ))
       
  1110     return KErrArgument;   
       
  1111  	
       
  1112  	CleanupStack::PopAndDestroy(pElement);
       
  1113     Teardown();
       
  1114     return KErrNone;
       
  1115     }       
       
  1116     
       
  1117 TInt CSenXmlBCTest::CSenBaseElement_SetNamespaceL_SNsPC1L (TTestResult& aResult)
       
  1118 	{
       
  1119 	SetupL();
       
  1120 	 CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1121    	 CleanupStack::PushL(pElement);
       
  1122      CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1123    	 CleanupStack::PushL(pParent);
       
  1124    	 pElement->SetParent(pParent);
       
  1125    	 pParent->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1126    	 pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1127    	 RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1128 /*   	 EUNIT_ASSERT(pNsList.Count()==0);*/
       
  1129     if(!(pNsList.Count()==0))
       
  1130     return KErrArgument;   
       
  1131 
       
  1132    	 CleanupStack::PopAndDestroy(pParent);
       
  1133    	 CleanupStack::PopAndDestroy(pElement);   	 
       
  1134 	Teardown();
       
  1135     return KErrNone;
       
  1136     }
       
  1137         
       
  1138 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_FL (TTestResult& aResult)
       
  1139     {
       
  1140     SetupL();
       
  1141      TBool Flag;
       
  1142      TBool CheckParent=FALSE;
       
  1143      CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1144    	 CleanupStack::PushL(pElement);
       
  1145    	 CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri"));
       
  1146      CleanupStack::PushL(pNs1);
       
  1147      const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent);
       
  1148 	 const TDesC8& pNsURI=pNs->URI();
       
  1149 	 const TDesC8& pNsPrefix=pNs->Prefix();
       
  1150 	 if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1151 	 	Flag=1;
       
  1152 	 else
       
  1153 		Flag=0;
       
  1154      CleanupStack::PopAndDestroy(pNs1);	
       
  1155 	 CleanupStack::PopAndDestroy(pElement);
       
  1156          /*EUNIT_ASSERT( Flag );*/
       
  1157     if(!Flag)
       
  1158     return KErrArgument;   
       
  1159 
       
  1160     Teardown();
       
  1161     return KErrNone;
       
  1162     }
       
  1163     
       
  1164 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_TL (TTestResult& aResult)
       
  1165     {
       
  1166     SetupL();
       
  1167     TBool Flag;
       
  1168     TBool CheckParent=TRUE;
       
  1169     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1170     CleanupStack::PushL(pElement);
       
  1171     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("ParentElement"));
       
  1172     CleanupStack::PushL(pParent);
       
  1173     
       
  1174     pElement->SetParent(pParent);
       
  1175     CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri"));
       
  1176     CleanupStack::PushL(pNs1);
       
  1177     const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent);
       
  1178     RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1179 	const TDesC8& pNsURI=pNs->URI();
       
  1180 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  1181 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1182 		Flag=1;
       
  1183 	else
       
  1184 		Flag=0;
       
  1185 	
       
  1186         /*EUNIT_ASSERT( Flag );*/
       
  1187     if(!Flag)
       
  1188     return KErrArgument;   
       
  1189 
       
  1190 /*    EUNIT_ASSERT( pNsList.Count()==1);*/
       
  1191     if(!(pNsList.Count()==1))
       
  1192     return KErrArgument;   
       
  1193 
       
  1194    	CleanupStack::PopAndDestroy(pNs1);
       
  1195    	CleanupStack::PopAndDestroy(pParent);	
       
  1196 	CleanupStack::PopAndDestroy(pElement);
       
  1197 	
       
  1198     Teardown();
       
  1199     return KErrNone;
       
  1200     }
       
  1201     
       
  1202 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_TSPL (TTestResult& aResult)
       
  1203     {
       
  1204     SetupL();
       
  1205      TBool Flag;
       
  1206      TBool CheckParent=TRUE;
       
  1207     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("ParentElement"));
       
  1208     CleanupStack::PushL(pParent);
       
  1209     pParent->AddNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1210     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1211     CleanupStack::PushL(pElement);
       
  1212     pElement->SetParent(pParent);
       
  1213     CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri"));
       
  1214     CleanupStack::PushL(pNs1);
       
  1215     const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent);
       
  1216     RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1217 	const TDesC8& pNsURI=pNs->URI();
       
  1218 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  1219 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1220 		Flag=1;
       
  1221 	else
       
  1222 		Flag=0;
       
  1223 	
       
  1224         /*EUNIT_ASSERT( Flag );*/
       
  1225     if(!Flag)
       
  1226     return KErrArgument;   
       
  1227 
       
  1228 /*    EUNIT_ASSERT( pNsList.Count()==0);*/
       
  1229     if(!(pNsList.Count()==0))
       
  1230     return KErrArgument; 
       
  1231 
       
  1232    	CleanupStack::PopAndDestroy(pNs1);	
       
  1233 	CleanupStack::PopAndDestroy(pElement);
       
  1234 	CleanupStack::PopAndDestroy(pParent);
       
  1235     Teardown();
       
  1236     return KErrNone;
       
  1237     }    
       
  1238 
       
  1239 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_TDPL (TTestResult& aResult)
       
  1240     {
       
  1241     SetupL();
       
  1242      TBool Flag;
       
  1243      TBool CheckParent=TRUE;
       
  1244     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("ParentElement"));
       
  1245     CleanupStack::PushL(pParent);
       
  1246     pParent->AddNamespaceL(_L8("N1"),_L8("namespaceuri1"));
       
  1247     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1248     CleanupStack::PushL(pElement);
       
  1249     pElement->SetParent(pParent);
       
  1250     CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri"));
       
  1251     CleanupStack::PushL(pNs1);
       
  1252     const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent);
       
  1253     RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1254 	const TDesC8& pNsURI=pNs->URI();
       
  1255 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  1256 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1257 		Flag=1;
       
  1258 	else
       
  1259 		Flag=0;
       
  1260 	
       
  1261         /*EUNIT_ASSERT( Flag );*/
       
  1262     if(!Flag)
       
  1263     return KErrArgument;   
       
  1264 
       
  1265 /*    EUNIT_ASSERT( pNsList.Count()==1);*/
       
  1266     if(!(pNsList.Count()==1))
       
  1267     return KErrArgument; 
       
  1268 
       
  1269    	CleanupStack::PopAndDestroy(pNs1);	
       
  1270 	CleanupStack::PopAndDestroy(pElement);
       
  1271 	CleanupStack::PopAndDestroy(pParent);
       
  1272     Teardown();
       
  1273     return KErrNone;
       
  1274     }    
       
  1275 
       
  1276 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_1L (TTestResult& aResult)
       
  1277     {
       
  1278     SetupL();
       
  1279      TBool Flag;
       
  1280     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1281     CleanupStack::PushL(pElement);
       
  1282     const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1283 	const TDesC8& pNsURI=pNs->URI();
       
  1284 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  1285 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1286 		Flag=1;
       
  1287 	else
       
  1288 		Flag=0;
       
  1289 	CleanupStack::PopAndDestroy(pElement);
       
  1290         /*EUNIT_ASSERT( Flag );*/
       
  1291     if(!Flag)
       
  1292     return KErrArgument;   
       
  1293 
       
  1294     Teardown();
       
  1295     return KErrNone;
       
  1296     }
       
  1297     
       
  1298 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_2same1L (TTestResult& aResult)
       
  1299     {
       
  1300     SetupL();
       
  1301      TBool Flag;
       
  1302     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1303     CleanupStack::PushL(pElement);
       
  1304     const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1305     pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  1306 	const TDesC8& pNsURI=pNs->URI();
       
  1307 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  1308 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  1309 		Flag=1;
       
  1310 	else
       
  1311 		Flag=0;
       
  1312         /*EUNIT_ASSERT( Flag );*/
       
  1313     if(!Flag)
       
  1314     return KErrArgument;   
       
  1315 
       
  1316 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1317  	/*EUNIT_ASSERT( pNsList.Count()==1 );*/
       
  1318     if(!(pNsList.Count()==1))
       
  1319     return KErrArgument;   
       
  1320  	
       
  1321 	CleanupStack::PopAndDestroy(pElement); 
       
  1322     Teardown();
       
  1323     return KErrNone;
       
  1324     }    
       
  1325  
       
  1326 TInt CSenXmlBCTest::CSenBaseElement_AddNamespaceL_2Diff1L (TTestResult& aResult)
       
  1327     {
       
  1328     SetupL();
       
  1329      TBool Flag;
       
  1330     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1331     CleanupStack::PushL(pElement);
       
  1332 	const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N1"),_L8("namespaceuri1"));
       
  1333     pNs=pElement->AddNamespaceL(_L8("N2"),_L8("namespaceuri2"));
       
  1334 	const TDesC8& pNsURI=pNs->URI();
       
  1335 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  1336 	if(pNsURI==_L8("namespaceuri2")&&pNsPrefix==_L8("N2"))
       
  1337 		Flag=1;
       
  1338 	else
       
  1339 		Flag=0;
       
  1340         /*EUNIT_ASSERT( Flag );*/
       
  1341     if(!Flag)
       
  1342     return KErrArgument;   
       
  1343 
       
  1344 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1345  	/*EUNIT_ASSERT( pNsList.Count()==2 );*/
       
  1346  	if(!(pNsList.Count()==2))
       
  1347     return KErrArgument;  
       
  1348  	
       
  1349  	CleanupStack::PopAndDestroy(pElement);
       
  1350     Teardown();
       
  1351     return KErrNone;
       
  1352     }    
       
  1353     
       
  1354 
       
  1355 TInt CSenXmlBCTest::CSenBaseElement_NamespaceL (TTestResult& aResult)
       
  1356     {
       
  1357     SetupL();
       
  1358     TBool Flag,Flag1,Flag2;
       
  1359     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1360     CleanupStack::PushL(pElement);
       
  1361     //NULL
       
  1362     pElement->SetNamespaceL(_L8(""));
       
  1363     const CSenNamespace* pNs2=pElement->Namespace();
       
  1364     if(pNs2==NULL)
       
  1365     	Flag2=1;
       
  1366     else
       
  1367     	Flag2=0;
       
  1368     /*EUNIT_ASSERT(Flag2);*/
       
  1369    	if(!Flag2)
       
  1370     return KErrArgument;  
       
  1371 
       
  1372    
       
  1373     //only URI
       
  1374     pElement->SetNamespaceL(_L8("nsuri"));
       
  1375     const CSenNamespace* pNs1=pElement->Namespace();
       
  1376     if(pNs1->Prefix()==_L8("")&&pNs1->URI()==_L8("nsuri"))
       
  1377     	Flag1=1;
       
  1378     else
       
  1379     	Flag1=0;
       
  1380     /*EUNIT_ASSERT(Flag1);*/
       
  1381   	if(!Flag1)
       
  1382     return KErrArgument;  
       
  1383 
       
  1384     //URI and Prefix
       
  1385     pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1386     const CSenNamespace* pNs=pElement->Namespace();
       
  1387     if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri"))
       
  1388     	Flag=1;
       
  1389     else
       
  1390     	Flag=0;
       
  1391         /*EUNIT_ASSERT( Flag );*/
       
  1392     if(!Flag)
       
  1393     return KErrArgument;   
       
  1394 
       
  1395     CleanupStack::PopAndDestroy(pElement);
       
  1396     Teardown();
       
  1397     return KErrNone;
       
  1398     }
       
  1399 
       
  1400 TInt CSenXmlBCTest::CSenBaseElement_Namespace_1L (TTestResult& aResult)
       
  1401     {
       
  1402     SetupL();
       
  1403      TBool Flag,Flag1;
       
  1404      //True case
       
  1405     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1406     CleanupStack::PushL(pElement);
       
  1407     pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1408     const CSenNamespace* pNs=pElement->Namespace(_L8("n"));
       
  1409     if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri"))
       
  1410     	Flag=1;
       
  1411     else
       
  1412     	Flag=0;
       
  1413         /*EUNIT_ASSERT( Flag );*/
       
  1414     if(!Flag)
       
  1415     return KErrArgument;   
       
  1416 
       
  1417     CleanupStack::PopAndDestroy(pElement);
       
  1418     //False case
       
  1419     pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1420     CleanupStack::PushL(pElement);
       
  1421     pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1422     pNs=pElement->Namespace(_L8("N"));
       
  1423     if(pNs==NULL)
       
  1424     	Flag1=1;
       
  1425     else
       
  1426     	Flag1=0;
       
  1427     /*EUNIT_ASSERT(Flag1);*/
       
  1428   	if(!Flag1)
       
  1429     return KErrArgument;  
       
  1430     
       
  1431     CleanupStack::PopAndDestroy(pElement);
       
  1432     Teardown();
       
  1433     return KErrNone;
       
  1434     }
       
  1435     
       
  1436 TInt CSenXmlBCTest::CSenBaseElement_Namespace_WP1L (TTestResult& aResult)
       
  1437     {
       
  1438     SetupL();
       
  1439      TBool Flag,Flag1;
       
  1440  	CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent")) ;
       
  1441  	CleanupStack::PushL(pParent);
       
  1442  	pParent->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1443     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1444     CleanupStack::PushL(pElement);
       
  1445     pElement->SetParent(pParent);
       
  1446     const CSenNamespace* pNs=pElement->Namespace(_L8("n"));
       
  1447     if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri"))
       
  1448     	Flag=1;
       
  1449     else
       
  1450     	Flag=0;
       
  1451         /*EUNIT_ASSERT( Flag );*/
       
  1452     if(!Flag)
       
  1453     return KErrArgument;   
       
  1454 
       
  1455     CleanupStack::PopAndDestroy(pElement);
       
  1456     CleanupStack::PopAndDestroy(pParent);
       
  1457     //False case
       
  1458     pParent=CSenBaseElement::NewL(_L8("Parent")) ;
       
  1459  	CleanupStack::PushL(pParent);
       
  1460  	pParent->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  1461     pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1462     CleanupStack::PushL(pElement);
       
  1463     pElement->SetParent(pParent);
       
  1464 	pNs=pElement->Namespace(_L8("N"));
       
  1465 	if(pNs==NULL)
       
  1466     	Flag1=1;
       
  1467     else
       
  1468     	Flag1=0;
       
  1469    /* EUNIT_ASSERT( Flag1 );*/
       
  1470   	if(!Flag1)
       
  1471     return KErrArgument;  
       
  1472     
       
  1473     CleanupStack::PopAndDestroy(pElement);
       
  1474     CleanupStack::PopAndDestroy(pParent);
       
  1475     Teardown();
       
  1476     return KErrNone;
       
  1477     }
       
  1478 
       
  1479 TInt CSenXmlBCTest::CSenBaseElement_Namespace_2L (TTestResult& aResult)
       
  1480     {
       
  1481     SetupL();
       
  1482     TBool Flag,Flag1;
       
  1483     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1484     CleanupStack::PushL(pElement);
       
  1485     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1486     CleanupStack::PushL(pParent);
       
  1487     pParent->SetNamespaceL(_L8("p"),_L8("nsurip"));
       
  1488     pElement->SetNamespaceL(_L8("n"),_L8("nsurin"));
       
  1489     pElement->SetParent(pParent);
       
  1490     //aCheckInParent=FALSE and parent prefix
       
  1491     const CSenNamespace* pPNs=pElement->Namespace(_L8("p"),FALSE);
       
  1492     if(pPNs==NULL)
       
  1493     	Flag=1;
       
  1494    	else
       
  1495    		Flag=0;
       
  1496         /*EUNIT_ASSERT( Flag );*/
       
  1497     if(!Flag)
       
  1498     return KErrArgument;   
       
  1499 
       
  1500     //aCheckInParent=TRUE and parent prefix
       
  1501     pPNs=pElement->Namespace(_L8("p"),TRUE);
       
  1502     if(pPNs->Prefix()==_L8("p") && pPNs->URI()==_L8("nsurip"))
       
  1503     	Flag1=1; 
       
  1504    	else
       
  1505    		Flag1=0;
       
  1506     /*EUNIT_ASSERT( Flag1 );*/
       
  1507   	if(!Flag1)
       
  1508     return KErrArgument;  
       
  1509     
       
  1510     CleanupStack::PopAndDestroy(pParent);
       
  1511     CleanupStack::PopAndDestroy(pElement);
       
  1512     Teardown();
       
  1513     return KErrNone;
       
  1514     }
       
  1515    
       
  1516 TInt CSenXmlBCTest::CSenBaseElement_Namespace_3L (TTestResult& aResult)
       
  1517     {
       
  1518     SetupL();
       
  1519     TBool Flag;
       
  1520     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1521     CleanupStack::PushL(pElement);
       
  1522     pElement->AddNamespaceL(_L8("n"),_L8("nsurin"));
       
  1523     pElement->AddNamespaceL(_L8("m"),_L8("nsurim"));
       
  1524     pElement->AddNamespaceL(_L8("l"),_L8("nsuril"));
       
  1525     RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  1526 /*    EUNIT_ASSERT( pNsList.Count()==3 );*/
       
  1527   	if(!( pNsList.Count()==3 ))
       
  1528     return KErrArgument;  
       
  1529     
       
  1530     const CSenNamespace* pNs=pElement->Namespace(_L8("m"),_L8("nsurim"));
       
  1531     if(pNs->Prefix()==_L8("m") && pNs->URI()==_L8("nsurim"))
       
  1532     	Flag=1;
       
  1533     else
       
  1534     	Flag=0;
       
  1535     /*EUNIT_ASSERT(Flag);*/
       
  1536   	if(!Flag)
       
  1537     return KErrArgument;  
       
  1538     
       
  1539     CleanupStack::PopAndDestroy(pElement);
       
  1540     Teardown();
       
  1541     return KErrNone;
       
  1542     }
       
  1543 
       
  1544 TInt CSenXmlBCTest::CSenBaseElement_ElementsLL (TTestResult& aResult)
       
  1545     {
       
  1546     SetupL();
       
  1547     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")) ;
       
  1548     CleanupStack::PushL(pElement);
       
  1549     CSenBaseElement* pChild1=CSenBaseElement::NewL(_L8("element1")) ;
       
  1550     CleanupStack::PushL(pChild1);
       
  1551     CSenBaseElement* pChild2=CSenBaseElement::NewL(_L8("element2")) ;
       
  1552     CleanupStack::PushL(pChild2);
       
  1553     CSenBaseElement* pChild3=CSenBaseElement::NewL(_L8("element3")) ;
       
  1554     CleanupStack::PushL(pChild3);
       
  1555     pElement->AddElementL(*pChild1);
       
  1556     pElement->AddElementL(*pChild2);
       
  1557     pElement->AddElementL(*pChild3);
       
  1558     RPointerArray<CSenElement>& ElList=pElement->ElementsL();
       
  1559 /*    EUNIT_ASSERT( ElList.Count()==3);*/
       
  1560   	if(!(ElList.Count()==3))
       
  1561     return KErrArgument;  
       
  1562 
       
  1563     CleanupStack::Pop(3);
       
  1564     CleanupStack::PopAndDestroy(pElement);
       
  1565     Teardown();
       
  1566     return KErrNone;
       
  1567     }
       
  1568 
       
  1569 TInt CSenXmlBCTest::CSenBaseElement_AttributesLL (TTestResult& aResult)
       
  1570     {
       
  1571     SetupL();
       
  1572     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")) ;
       
  1573     CleanupStack::PushL(pElement);
       
  1574     pElement->AddAttrL(_L8("Attr1"),_L8("value1"));
       
  1575     pElement->AddAttrL(_L8("Attr2"),_L8("value2"));
       
  1576     pElement->AddAttrL(_L8("Attr3"),_L8("value3"));
       
  1577     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  1578     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  1579     RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL();
       
  1580 /*    EUNIT_ASSERT( pAttrList.Count()==4 );*/
       
  1581   	if(!( pAttrList.Count()==4 ))
       
  1582     return KErrArgument;  
       
  1583 
       
  1584     CleanupStack::PopAndDestroy(pElement);
       
  1585     Teardown();
       
  1586     return KErrNone;
       
  1587     }
       
  1588 
       
  1589 TInt CSenXmlBCTest::CSenBaseElement_NamespacesLL (TTestResult& aResult)
       
  1590     {
       
  1591     SetupL();
       
  1592     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1593     CleanupStack::PushL(pElement);
       
  1594     pElement->AddNamespaceL(_L8("l"),_L8("nsuril"));
       
  1595     pElement->AddNamespaceL(_L8("m"),_L8("nsurim"));
       
  1596     pElement->AddNamespaceL(_L8("n"),_L8("nsurin"));
       
  1597     pElement->AddNamespaceL(_L8("m"),_L8("nsurim"));
       
  1598     const RPointerArray<CSenNamespace>& pNs=pElement->NamespacesL();
       
  1599 /*    EUNIT_ASSERT( pNs.Count()==3);*/
       
  1600   	if(!(pNs.Count()==3))
       
  1601     return KErrArgument;  
       
  1602 
       
  1603     CleanupStack::PopAndDestroy(pElement);
       
  1604     Teardown();
       
  1605     return KErrNone;
       
  1606     }
       
  1607 
       
  1608 TInt CSenXmlBCTest::CSenBaseElement_AttrValueL (TTestResult& aResult)
       
  1609     {
       
  1610     SetupL();
       
  1611     TBool Flag,NegFlag;
       
  1612     _LIT8(KValue,"value4");
       
  1613     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia")) ;
       
  1614     pElement->AddAttrL(_L8("Attr1"),_L8("value1"));
       
  1615     pElement->AddAttrL(_L8("Attr2"),_L8("value2"));
       
  1616     pElement->AddAttrL(_L8("Attr3"),_L8("value3"));
       
  1617     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  1618     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  1619     const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr4"));
       
  1620     if(pAttrVal!=NULL)
       
  1621     {
       
  1622     	Flag=1;
       
  1623     }
       
  1624     else
       
  1625     	Flag=0;
       
  1626 /*    EUNIT_ASSERT(Flag);*/
       
  1627   	if(!Flag)
       
  1628     return KErrArgument;  
       
  1629     
       
  1630     const TDesC8* pNegAttrVal=pElement->AttrValue(_L8("attr1"));
       
  1631     if(pNegAttrVal==NULL)
       
  1632     	NegFlag=1;
       
  1633     else
       
  1634     	NegFlag=0;
       
  1635 /*    EUNIT_ASSERT(NegFlag);*/
       
  1636   	if(!NegFlag)
       
  1637     return KErrArgument;  
       
  1638     
       
  1639     delete pElement;
       
  1640     Teardown();
       
  1641     return KErrNone;
       
  1642     }
       
  1643 
       
  1644 TInt CSenXmlBCTest::CSenBaseElement_AddAttrLL (TTestResult& aResult)
       
  1645     {
       
  1646     SetupL();
       
  1647     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1648     CleanupStack::PushL(pElement);
       
  1649     pElement->AddAttrL(_L8("Attr1"),_L8("value1"));
       
  1650     RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL();
       
  1651 /*    EUNIT_ASSERT( pAttrList.Count()==1 );*/
       
  1652   	if(!( pAttrList.Count()==1 ))
       
  1653     return KErrArgument;  
       
  1654     
       
  1655     pElement->AddAttrL(_L8("Attr1"),_L8("Duplicatevalue1"));
       
  1656 /*    EUNIT_ASSERT( pAttrList.Count()==1 );*/
       
  1657   	if(!( pAttrList.Count()==1 ))
       
  1658     return KErrArgument;  
       
  1659 
       
  1660     const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr1"));
       
  1661     pElement->AddAttrL(_L8("Attr2"),_L8(" value2"));//improve here by comparing TDesC8* AttrValue()
       
  1662     /*EUNIT_ASSERT( pAttrList.Count()==2 );*/
       
  1663   	if(!( pAttrList.Count()==2 ))
       
  1664     return KErrArgument;  
       
  1665     
       
  1666     CleanupStack::PopAndDestroy(pElement);
       
  1667     Teardown();
       
  1668     return KErrNone;
       
  1669     }
       
  1670 TInt CSenXmlBCTest::CSenBaseElement_AddAttributeLL (TTestResult& aResult)
       
  1671     {
       
  1672     SetupL();
       
  1673     CTestBaseElement* pElement=CTestBaseElement::NewL(_L8("Nokia"));
       
  1674     CleanupStack::PushL(pElement);
       
  1675     pElement->AddAttributeL(_L8("Attr1"),_L8("value1"));
       
  1676     
       
  1677     CleanupStack::PopAndDestroy(pElement);
       
  1678     Teardown();
       
  1679     return KErrNone;
       
  1680     }
       
  1681 
       
  1682 TInt CSenXmlBCTest::CSenBaseElement_ParentL (TTestResult& aResult)
       
  1683     {
       
  1684     SetupL();
       
  1685     TBool Flag,PFlag,PPFlag;
       
  1686     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1687     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1688     CSenBaseElement* pPParent=CSenBaseElement::NewL(_L8("parent of parent"));
       
  1689     pElement->SetParent(pParent);
       
  1690     pParent->SetParent(pPParent);
       
  1691     CSenElement* pEl1= pElement->Parent();
       
  1692     CSenElement* pEl2= pParent->Parent();
       
  1693     CSenElement* pEl3= pPParent->Parent();
       
  1694     const TDesC8& pLName1=pEl1->LocalName();
       
  1695     if(pLName1==_L8("Parent"))
       
  1696     	Flag=1;
       
  1697    	else
       
  1698    		Flag=0;
       
  1699         /*EUNIT_ASSERT( Flag );*/
       
  1700     if(!Flag)
       
  1701     return KErrArgument;   
       
  1702 
       
  1703     const TDesC8& pLName2=pEl2->LocalName();
       
  1704     if(pLName2==_L8("parent of parent"))
       
  1705     	PFlag=1;
       
  1706     else
       
  1707     	PFlag=0;
       
  1708 /*    EUNIT_ASSERT(PFlag);*/
       
  1709   	if(!PFlag)
       
  1710     return KErrArgument;  
       
  1711     
       
  1712     if(pEl3==NULL)
       
  1713     	PPFlag=1;
       
  1714     else
       
  1715     	PPFlag=0;
       
  1716     /*EUNIT_ASSERT(PPFlag);*/
       
  1717   	if(!PFlag)
       
  1718     return KErrArgument;  
       
  1719     
       
  1720     delete pElement;
       
  1721     delete pParent;
       
  1722     delete pPParent;
       
  1723     Teardown();
       
  1724     return KErrNone;
       
  1725     }
       
  1726     
       
  1727 TInt CSenXmlBCTest::CSenBaseElement_SetParentL (TTestResult& aResult)
       
  1728     {
       
  1729     SetupL();
       
  1730     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1731     CleanupStack::PushL(pElement);
       
  1732     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1733     CleanupStack::PushL(pParent);
       
  1734     pElement->SetNamespaceL(_L8("Nsuria"));
       
  1735     pParent->SetNamespaceL(_L8("nsurip"));
       
  1736     pElement->SetParent(pParent);
       
  1737     CSenElement* pPar=pElement->Parent();
       
  1738     const TDesC8& ParName=pPar->LocalName();
       
  1739     /*EUNIT_ASSERT_EQUALS( ParName,_L8("Parent") );*/
       
  1740     TL(ParName == _L8("Parent"));
       
  1741     CleanupStack::PopAndDestroy(pParent);
       
  1742     CleanupStack::PopAndDestroy(pElement);
       
  1743     Teardown();
       
  1744     return KErrNone;
       
  1745     }
       
  1746 
       
  1747 TInt CSenXmlBCTest::CSenBaseElement_RootL (TTestResult& aResult)
       
  1748     {
       
  1749     SetupL();    
       
  1750     TBool Flag;
       
  1751     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  1752     const MSenElement& pElRoot=pElement->Root();
       
  1753     const TDesC8& pElLName=pElRoot.LocalName();
       
  1754     if(pElLName==_L8("Nokia"))
       
  1755     	Flag=1;
       
  1756     else
       
  1757     	Flag=0;
       
  1758     
       
  1759     CSenBaseElement* pParent1=CSenBaseElement::NewL(_L8("Parent1"));
       
  1760     pElement->SetParent(pParent1);
       
  1761     const MSenElement& pElRoot1=pElement->Root();
       
  1762     const TDesC8& pElLName1=pElRoot1.LocalName();
       
  1763     if(pElLName1==_L8("Parent1"))
       
  1764     	Flag=1;
       
  1765     else
       
  1766     	Flag=0;
       
  1767     
       
  1768     CSenBaseElement* pParent2=CSenBaseElement::NewL(_L8("Parent2"));
       
  1769     pParent1->SetParent(pParent2);
       
  1770     const MSenElement& pElRoot2=pElement->Root();
       
  1771     const TDesC8& pElLName2=pElRoot2.LocalName();
       
  1772 	const MSenElement& pParRoot=pParent1->Root();
       
  1773     const TDesC8& pParLName=pParRoot.LocalName();
       
  1774     if(pElLName2==_L8("Parent2") && pParLName==_L8("Parent2"))
       
  1775     	Flag=1;
       
  1776     else
       
  1777     	Flag=0;
       
  1778         
       
  1779         /*EUNIT_ASSERT( Flag );*/
       
  1780     if(!Flag)
       
  1781     return KErrArgument;   
       
  1782 
       
  1783     delete pElement;
       
  1784     delete pParent1;
       
  1785     delete pParent2;
       
  1786     Teardown();
       
  1787     return KErrNone;
       
  1788     }
       
  1789 
       
  1790 TInt CSenXmlBCTest::CSenBaseElement_ElementL (TTestResult& aResult)
       
  1791     {
       
  1792     SetupL();
       
  1793     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1794     CleanupStack::PushL(pParent);
       
  1795     CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1"));
       
  1796     CleanupStack::PushL(pElement1);
       
  1797     CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2"));
       
  1798     CleanupStack::PushL(pElement2);
       
  1799     CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3"));
       
  1800     CleanupStack::PushL(pElement3);
       
  1801     pParent->AddElementL(*pElement1);
       
  1802     pParent->AddElementL(*pElement2);
       
  1803     pParent->AddElementL(*pElement3);
       
  1804     CSenElement* element=pParent->Element(_L8("Nokia1"));
       
  1805 /*    EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/
       
  1806   	if(!(element->LocalName()==_L8("Nokia1")))
       
  1807     return KErrArgument;  
       
  1808 
       
  1809     CleanupStack::Pop(3);
       
  1810     CleanupStack::PopAndDestroy(pParent);
       
  1811     Teardown();
       
  1812     return KErrNone;
       
  1813     }
       
  1814 TInt CSenXmlBCTest::CSenBaseElement_ElementsL1 (TTestResult& aResult)
       
  1815     {
       
  1816     SetupL();
       
  1817     //RPointerArray<CSenElement> &array;
       
  1818     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1819     CleanupStack::PushL(pParent);
       
  1820     CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1"));
       
  1821     CleanupStack::PushL(pElement1);
       
  1822     CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2"));
       
  1823     CleanupStack::PushL(pElement2);
       
  1824     CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3"));
       
  1825     CleanupStack::PushL(pElement3);
       
  1826     pParent->AddElementL(*pElement1);
       
  1827     pParent->AddElementL(*pElement2);
       
  1828     pParent->AddElementL(*pElement3);
       
  1829     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  1830     pParent->ElementsL(elementList, _L8("Nokia1"), _L8("Nokia1"));
       
  1831 /*    EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/
       
  1832   	//if(!(element->LocalName()==_L8("Nokia1")))
       
  1833     //return KErrArgument;  
       
  1834 
       
  1835     CleanupStack::Pop(3);
       
  1836     CleanupStack::PopAndDestroy(pParent);
       
  1837     Teardown();
       
  1838     return KErrNone;
       
  1839     }
       
  1840 
       
  1841 
       
  1842 TInt CSenXmlBCTest::CSenBaseElement_ElementsL2 (TTestResult& aResult)
       
  1843     {
       
  1844     SetupL();
       
  1845     //RPointerArray<CSenElement> &array;
       
  1846     
       
  1847     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1848     CleanupStack::PushL(pParent);
       
  1849     CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1"));
       
  1850     CleanupStack::PushL(pElement1);
       
  1851     CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2"));
       
  1852     CleanupStack::PushL(pElement2);
       
  1853     CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3"));
       
  1854     CleanupStack::PushL(pElement3);
       
  1855     pParent->AddElementL(*pElement1);
       
  1856     pParent->AddElementL(*pElement2);
       
  1857     pParent->AddElementL(*pElement3);
       
  1858     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  1859 
       
  1860     pParent->ElementsL(elementList, _L8("Nokia1"));
       
  1861 /*    EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/
       
  1862   	//if(!(element->LocalName()==_L8("Nokia1")))
       
  1863     //return KErrArgument;  
       
  1864 
       
  1865     CleanupStack::Pop(3);
       
  1866     CleanupStack::Pop(pParent);
       
  1867     Teardown();
       
  1868     return KErrNone;
       
  1869     }
       
  1870 
       
  1871 TInt CSenXmlBCTest::CSenBaseElement_CreateElementLL (TTestResult& aResult)
       
  1872     {
       
  1873     SetupL();
       
  1874     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("element"));
       
  1875     CleanupStack::PushL(pElement);
       
  1876     pElement->SetNamespaceL(_L8("N"),_L8("nsuri"));
       
  1877     CSenElement* pNewElement=pElement->CreateElementL(_L8("N"),_L8("Nokia"));
       
  1878     CleanupStack::PushL(pNewElement);
       
  1879     HBufC8* ElementBuf=pNewElement->AsXmlL();
       
  1880 /*    EUNIT_ASSERT_EQUALS(*ElementBuf,_L8("<N:Nokia xmlns:N=\"nsuri\"/>"));*/
       
  1881     TL(*ElementBuf == _L8("<N:Nokia xmlns:N=\"nsuri\"/>"));
       
  1882     CleanupStack::PopAndDestroy(pNewElement);
       
  1883     CleanupStack::PopAndDestroy(pElement);
       
  1884     delete ElementBuf;
       
  1885     Teardown();
       
  1886     return KErrNone;
       
  1887     }
       
  1888 
       
  1889 TInt CSenXmlBCTest::CSenBaseElement_InsertElementLL (TTestResult& aResult)
       
  1890     {
       
  1891     SetupL(); 
       
  1892      TBool Flag;
       
  1893      CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("Parent"));
       
  1894      CleanupStack::PushL(pParent);
       
  1895      CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Nokia1"));
       
  1896      CleanupStack::PushL(pElement1);
       
  1897      CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Nokia2"));
       
  1898      CleanupStack::PushL(pElement2);
       
  1899      CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Nokia3"));
       
  1900      CleanupStack::PushL(pElement3);
       
  1901      CSenBaseElement* pElement5=CSenBaseElement::NewL(_L8("Nokia5"));
       
  1902      CleanupStack::PushL(pElement5);
       
  1903      pParent->AddElementL(*pElement1);
       
  1904      pParent->AddElementL(*pElement2);
       
  1905      pParent->AddElementL(*pElement3);
       
  1906      pParent->AddElementL(*pElement5);
       
  1907      CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Nokia4"));
       
  1908      CleanupStack::PushL(pElement4);
       
  1909      pParent->InsertElementL(*pElement4,*pElement5);
       
  1910      RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  1911      const TDesC8& localName=elementList[3]->LocalName();
       
  1912      if(localName==_L8("Nokia4"))
       
  1913      	Flag=1;
       
  1914      else
       
  1915      	Flag=0;
       
  1916      /*EUNIT_ASSERT( Flag );*/
       
  1917     if(!Flag)
       
  1918     return KErrArgument;   
       
  1919 
       
  1920      if(!Flag)
       
  1921      return KErrArgument;
       
  1922      
       
  1923      CleanupStack::Pop(pElement4);
       
  1924 	 CleanupStack::Pop(pElement5);
       
  1925      CleanupStack::Pop(pElement3);
       
  1926      CleanupStack::Pop(pElement2);
       
  1927      CleanupStack::Pop(pElement1);
       
  1928      CleanupStack::PopAndDestroy(pParent); 
       
  1929     Teardown();
       
  1930     return KErrNone;
       
  1931     }
       
  1932 	 
       
  1933 TInt CSenXmlBCTest::CSenBaseElement_InsertElementL_NoBeforeL (TTestResult& aResult)               
       
  1934 	{
       
  1935     SetupL();
       
  1936 	TBool Flag;
       
  1937 	CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  1938 	CleanupStack::PushL(pParent);
       
  1939 	CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("nokia"));
       
  1940 	CleanupStack::PushL(pElement1);
       
  1941 	
       
  1942 	CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("nokia2"));
       
  1943 	CleanupStack::PushL(pElement2);
       
  1944 	
       
  1945 	CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("nokia3"));
       
  1946 	CleanupStack::PushL(pElement3);
       
  1947 	pParent->AddElementL(*pElement1);
       
  1948 	pParent->AddElementL(*pElement2);
       
  1949 	pParent->AddElementL(*pElement3);
       
  1950 	
       
  1951 	
       
  1952 	CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("nokia4"));
       
  1953 	CleanupStack::PushL(pElement4);
       
  1954 	
       
  1955 	
       
  1956 	CSenBaseElement* pElement5=CSenBaseElement::NewL(_L8("nokia5"));
       
  1957 	CleanupStack::PushL(pElement5);
       
  1958 	
       
  1959 	pParent->InsertElementL(*pElement4,*pElement5);
       
  1960 	RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  1961 	const TDesC8& localName=elementList[(elementList.Count()-1)]->LocalName();
       
  1962 	if(localName==_L8("nokia4"))
       
  1963 		Flag=1;
       
  1964 	else
       
  1965 		Flag=0;
       
  1966 		
       
  1967 /*	EUNIT_ASSERT(Flag);*/
       
  1968 	if(!Flag)
       
  1969     return KErrArgument;
       
  1970 	
       
  1971 	CleanupStack::PopAndDestroy(pElement5);
       
  1972 	CleanupStack::Pop(pElement4);
       
  1973     CleanupStack::Pop(pElement3);
       
  1974     CleanupStack::Pop(pElement2);
       
  1975     CleanupStack::Pop(pElement1);
       
  1976     CleanupStack::PopAndDestroy(pParent); 
       
  1977  	Teardown();
       
  1978     return KErrNone;
       
  1979     }
       
  1980 
       
  1981 TInt CSenXmlBCTest::CSenBaseElement_AddElementLL (TTestResult& aResult)
       
  1982     {
       
  1983     SetupL();
       
  1984     TBool Flag;
       
  1985     CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent"));
       
  1986     CleanupStack::PushL(pParent);
       
  1987     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nokia"));
       
  1988     CleanupStack::PushL(pElement);
       
  1989     CSenElement& newElement=pParent->AddElementL(*pElement);
       
  1990     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  1991     const TDesC8& localName=elementList[0]->LocalName();
       
  1992     if(localName==_L8("nokia") && elementList.Count()==1 )
       
  1993     	Flag=1;
       
  1994     else
       
  1995     	Flag=0;
       
  1996     /*EUNIT_ASSERT( Flag );*/
       
  1997     if(!Flag)
       
  1998     return KErrArgument;   
       
  1999     
       
  2000 	if(!Flag)
       
  2001     return KErrArgument;
       
  2002 	
       
  2003     CleanupStack::Pop(pElement);
       
  2004     CleanupStack::PopAndDestroy(pParent);
       
  2005     Teardown();
       
  2006     return KErrNone;
       
  2007     }
       
  2008 
       
  2009 TInt CSenXmlBCTest::CSenBaseElement_AddElementL_1L (TTestResult& aResult)
       
  2010     {
       
  2011     SetupL();
       
  2012     TBool Flag;
       
  2013     CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2014     CleanupStack::PushL(pParent);
       
  2015     CSenElement& newElement=pParent->AddElementL(_L8("element"));
       
  2016     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  2017     const TDesC8& localName=elementList[0]->LocalName(); 
       
  2018     if(localName==_L8("element") && elementList.Count()==1 )
       
  2019     	Flag=1;
       
  2020     else
       
  2021     	Flag=0;
       
  2022     /*EUNIT_ASSERT( Flag );*/
       
  2023     if(!Flag)
       
  2024     return KErrArgument;   
       
  2025     
       
  2026    	if(!Flag)
       
  2027     return KErrArgument;
       
  2028 	
       
  2029     CleanupStack::PopAndDestroy(pParent);
       
  2030     Teardown();
       
  2031     return KErrNone;
       
  2032     }
       
  2033 
       
  2034 TInt CSenXmlBCTest::CSenBaseElement_AddElementL_2L (TTestResult& aResult)
       
  2035     {
       
  2036     SetupL();
       
  2037     TBool Flag;
       
  2038     CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2039     CleanupStack::PushL(pParent);
       
  2040     CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element"));
       
  2041     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  2042     const TDesC8& localName=elementList[0]->LocalName(); 
       
  2043     const TDesC8& nsUri=elementList[0]->NamespaceURI(); 
       
  2044     if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria"))
       
  2045     	Flag=1;
       
  2046     else
       
  2047     	Flag=0;
       
  2048     /*EUNIT_ASSERT( Flag );*/
       
  2049     if(!Flag)
       
  2050     return KErrArgument;   
       
  2051 
       
  2052     CleanupStack::PopAndDestroy(pParent);
       
  2053     Teardown();
       
  2054     return KErrNone;
       
  2055     }
       
  2056 
       
  2057 TInt CSenXmlBCTest::CSenBaseElement_AddElementL_3L (TTestResult& aResult)
       
  2058     {
       
  2059     SetupL();
       
  2060 	TBool Flag;
       
  2061     CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2062     CleanupStack::PushL(pParent);
       
  2063     CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element"),_L8("e:element"));
       
  2064     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  2065     const TDesC8& localName=elementList[0]->LocalName(); 
       
  2066     const TDesC8& nsUri=elementList[0]->NamespaceURI(); 
       
  2067     if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria"))
       
  2068     	Flag=1;
       
  2069     else
       
  2070     	Flag=0;
       
  2071      /*EUNIT_ASSERT( Flag );*/
       
  2072     if(!Flag)
       
  2073     return KErrArgument;   
       
  2074 	
       
  2075     CleanupStack::PopAndDestroy(pParent);    
       
  2076     Teardown();
       
  2077     return KErrNone;
       
  2078     }
       
  2079 
       
  2080 TInt CSenXmlBCTest::CSenBaseElement_RemoveElementL (TTestResult& aResult)
       
  2081     {
       
  2082     SetupL();
       
  2083     TBool TFlag;
       
  2084     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2085     CleanupStack::PushL(pParent);
       
  2086     CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Element1"));
       
  2087     CleanupStack::PushL(pElement1);
       
  2088     CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Element2"));
       
  2089     CleanupStack::PushL(pElement2);
       
  2090     CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Element3"));
       
  2091     CleanupStack::PushL(pElement3);
       
  2092     CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Element4"));
       
  2093     CleanupStack::PushL(pElement4);
       
  2094     pParent->AddElementL(*pElement1);
       
  2095     pParent->AddElementL(*pElement2);
       
  2096     pParent->AddElementL(*pElement3);
       
  2097     pParent->AddElementL(*pElement4);
       
  2098     //true case
       
  2099     CSenElement* pRmdElement=pParent->RemoveElement(*pElement3);
       
  2100     const TDesC8& localName=pRmdElement->LocalName();
       
  2101     /*CSenElement* pParElement=pElement3->Parent();//intentional
       
  2102     const TDesC8& localnmae1=pParElement->LocalName();*/
       
  2103     RPointerArray<CSenElement>& elList=pParent->ElementsL();
       
  2104     if(localName==_L8("Element3") && elList.Count()==3 )
       
  2105     	TFlag=1;
       
  2106     else
       
  2107     	TFlag=0;
       
  2108 /*    EUNIT_ASSERT( TFlag );*/
       
  2109 	if(!TFlag)
       
  2110     return KErrArgument;
       
  2111 	
       
  2112     CleanupStack::Pop(4);
       
  2113     CleanupStack::PopAndDestroy(pParent);
       
  2114     delete pRmdElement;
       
  2115     //delete pRmdElement1;
       
  2116     Teardown();
       
  2117     return KErrNone;
       
  2118     }
       
  2119 
       
  2120 TInt CSenXmlBCTest::CSenBaseElement_RemoveElement_1L (TTestResult& aResult)
       
  2121     {
       
  2122     SetupL();
       
  2123     TBool TFlag,FFlag;
       
  2124     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2125     CleanupStack::PushL(pParent);
       
  2126     pParent->AddElementL(_L8("element1"));
       
  2127     pParent->AddElementL(_L8("element2"));
       
  2128     pParent->AddElementL(_L8("element3"));
       
  2129     pParent->AddElementL(_L8("element4"));
       
  2130     //True case
       
  2131     CSenElement* pRmdElement=pParent->RemoveElement(_L8("element1"));
       
  2132     RPointerArray<CSenElement>& elList=pParent->ElementsL();   
       
  2133     if(pRmdElement->LocalName()==_L8("element1") && elList.Count()==3)
       
  2134     	TFlag=1;
       
  2135     else
       
  2136     	TFlag=0;
       
  2137 /*    EUNIT_ASSERT( TFlag );*/
       
  2138 	if(!TFlag)
       
  2139     return KErrArgument;
       
  2140 	
       
  2141     //False case
       
  2142     CSenElement* pRmdElement1=pParent->RemoveElement(_L8("none"));
       
  2143     elList=pParent->ElementsL();
       
  2144     if(pRmdElement1==NULL && elList.Count()==3)
       
  2145     	FFlag=1;
       
  2146     else
       
  2147     	FFlag=0;
       
  2148 /*    EUNIT_ASSERT(FFlag);*/
       
  2149 	if(!FFlag)
       
  2150     return KErrArgument;
       
  2151 
       
  2152 	CleanupStack::PopAndDestroy(pParent);
       
  2153 	delete pRmdElement;
       
  2154 	//delete pRmdElement1;
       
  2155     Teardown();
       
  2156     return KErrNone;
       
  2157     }
       
  2158 
       
  2159 TInt CSenXmlBCTest::CSenBaseElement_RemoveElement_2L (TTestResult& aResult)
       
  2160     {
       
  2161     SetupL();
       
  2162     TBool TFlag,FFlag;
       
  2163     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2164     CleanupStack::PushL(pParent);
       
  2165     pParent->AddElementL(_L8("nsuri1"),_L8("element1"));
       
  2166     pParent->AddElementL(_L8("nsuri2"),_L8("element2"));
       
  2167     pParent->AddElementL(_L8("nsuri2a"),_L8("element2"));
       
  2168     pParent->AddElementL(_L8("nsuri4"),_L8("element4"));
       
  2169     //True case
       
  2170     CSenElement* pRmdElement=pParent->RemoveElement(_L8("nsuri2a"),_L8("element2"));
       
  2171     RPointerArray<CSenElement>& elList=pParent->ElementsL();   
       
  2172     const TDesC8& localName=pRmdElement->LocalName();
       
  2173     const TDesC8& nsURI=pRmdElement->NamespaceURI();
       
  2174     if(localName==_L8("element2") && nsURI==_L8("nsuri2a") && elList.Count()==3)
       
  2175     	TFlag=1;
       
  2176     else
       
  2177     	TFlag=0;
       
  2178     /*EUNIT_ASSERT( TFlag );*/
       
  2179 	if(!TFlag)
       
  2180     return KErrArgument;
       
  2181 
       
  2182     //False case
       
  2183     CSenElement* pRmdElement1=pParent->RemoveElement(_L8("element1"),_L8("nothing"));
       
  2184     elList=pParent->ElementsL();
       
  2185     if(pRmdElement1==NULL && elList.Count()==3)
       
  2186     	FFlag=1;
       
  2187     else
       
  2188     	FFlag=0;
       
  2189 /*    EUNIT_ASSERT(FFlag);*/
       
  2190 	if(!FFlag)
       
  2191     return KErrArgument;
       
  2192 
       
  2193     CleanupStack::PopAndDestroy(pParent);
       
  2194 	delete pRmdElement;
       
  2195 	delete pRmdElement1;
       
  2196     
       
  2197     Teardown();
       
  2198     return KErrNone;
       
  2199     }
       
  2200 
       
  2201 TInt CSenXmlBCTest::CSenBaseElement_ReplaceElementLL (TTestResult& aResult)
       
  2202     {
       
  2203     SetupL();
       
  2204     TBool FFlag,TFlag;
       
  2205     _LIT8(KNewElement,"<a:Element1 xmlns:a=\"nsuria\"><subelement1/>New content</a:Element1>");
       
  2206     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2207     CleanupStack::PushL(pParent);
       
  2208     CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Element1"));
       
  2209     CleanupStack::PushL(pElement1);
       
  2210     pElement1->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  2211     pElement1->SetContentL(_L8("old content"));
       
  2212     CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Element2"));
       
  2213     CleanupStack::PushL(pElement2);
       
  2214     CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Element3"));
       
  2215     CleanupStack::PushL(pElement3);
       
  2216     CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Element4"));
       
  2217     CleanupStack::PushL(pElement4);
       
  2218     pParent->AddElementL(*pElement1);
       
  2219     pParent->AddElementL(*pElement2);
       
  2220     pParent->AddElementL(*pElement3);
       
  2221     pParent->AddElementL(*pElement4); 
       
  2222     //true case
       
  2223     CSenBaseElement* pNewElement=CSenBaseElement::NewL(_L8("Element1"));
       
  2224     pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  2225     CleanupStack::PushL(pNewElement);
       
  2226     pNewElement->AddElementL(_L8("subelement1"));
       
  2227     pNewElement->SetContentL(_L8("New content"));
       
  2228     CSenElement* pReplacedElement=pParent->ReplaceElementL(*pNewElement);
       
  2229     RPointerArray<CSenElement>& elList=pParent->ElementsL();
       
  2230     HBufC8* pRepBuf=elList[(elList.Count()-1)]->AsXmlL();
       
  2231     if(pReplacedElement!=NULL && elList.Count()==4 && 
       
  2232     	elList[(elList.Count()-1)]->LocalName()==_L8("Element1") && 
       
  2233     	*pRepBuf==KNewElement && elList[(elList.Count()-1)]->Content()==_L8("New content") )
       
  2234     	TFlag=1;
       
  2235     else
       
  2236     	TFlag=0;
       
  2237 /*    EUNIT_ASSERT( TFlag );*/
       
  2238 	if(!TFlag)
       
  2239     return KErrArgument;
       
  2240 
       
  2241     //False case
       
  2242     CSenBaseElement* pNewElement1=CSenBaseElement::NewL(_L8("New Element1"));
       
  2243     pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  2244     CleanupStack::PushL(pNewElement1);
       
  2245     CSenElement* pReplacedElement1=pParent->ReplaceElementL(*pNewElement1);
       
  2246     RPointerArray<CSenElement>& elList1=pParent->ElementsL();
       
  2247     if(pReplacedElement1==NULL && elList1.Count()==5)
       
  2248     	FFlag=1;
       
  2249     else
       
  2250     	FFlag=0;
       
  2251 /*    EUNIT_ASSERT(FFlag);*/
       
  2252 	if(!FFlag)
       
  2253     return KErrArgument;
       
  2254 
       
  2255     CleanupStack::Pop(pNewElement1);
       
  2256     CleanupStack::Pop(pNewElement);
       
  2257     CleanupStack::Pop(4);
       
  2258     CleanupStack::PopAndDestroy(pParent);
       
  2259     delete pReplacedElement;
       
  2260     delete pRepBuf;
       
  2261     delete pReplacedElement1;
       
  2262     Teardown();
       
  2263     return KErrNone;
       
  2264     }
       
  2265 
       
  2266 TInt CSenXmlBCTest::CSenBaseElement_AsXmlLL (TTestResult& aResult)
       
  2267     {
       
  2268     SetupL();
       
  2269     TBool Flag;
       
  2270     _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>");
       
  2271     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2272     CleanupStack::PushL(pParent) ;
       
  2273     pParent->AddElementL(_L8("element1"));
       
  2274     pParent->AddElementL(_L8("element2"));
       
  2275     pParent->SetContentL(_L8("parent content"));
       
  2276     pParent->AddElementL(_L8("element3"));
       
  2277     HBufC8* parBuf=pParent->AsXmlL();
       
  2278     if(*parBuf==KString)
       
  2279      	Flag=1;
       
  2280     else
       
  2281     	Flag=0;
       
  2282     /*EUNIT_ASSERT( Flag );*/
       
  2283     if(!Flag)
       
  2284     return KErrArgument;   
       
  2285     
       
  2286     delete parBuf;
       
  2287     CleanupStack::PopAndDestroy(pParent);
       
  2288     Teardown();
       
  2289     return KErrNone;
       
  2290     }
       
  2291 
       
  2292 TInt CSenXmlBCTest::CSenBaseElement_AsXmlUnicodeLL (TTestResult& aResult)
       
  2293     {
       
  2294     SetupL();
       
  2295     TBool Flag;
       
  2296     _LIT(KString,"<parent><element1/><element2/><element3/>parent content</parent>");
       
  2297     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2298     CleanupStack::PushL(pParent) ;
       
  2299     pParent->AddElementL(_L8("element1"));
       
  2300     pParent->AddElementL(_L8("element2"));
       
  2301     pParent->SetContentL(_L8("parent content"));
       
  2302     pParent->AddElementL(_L8("element3"));
       
  2303     HBufC* parBuf=pParent->AsXmlUnicodeL();
       
  2304     if(*parBuf==KString)
       
  2305      	Flag=1;
       
  2306     else
       
  2307     	Flag=0;
       
  2308     /*EUNIT_ASSERT( Flag );*/
       
  2309     if(!Flag)
       
  2310     return KErrArgument;   
       
  2311     
       
  2312     delete parBuf;
       
  2313     CleanupStack::PopAndDestroy(pParent);
       
  2314     Teardown();
       
  2315     return KErrNone;
       
  2316     }
       
  2317 
       
  2318 TInt CSenXmlBCTest::CSenBaseElement_CopyFromLL (TTestResult& aResult)
       
  2319     {
       
  2320     SetupL();
       
  2321     TBool Flag;
       
  2322     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("xml element"));
       
  2323     CleanupStack::PushL(pElement);
       
  2324     pElement->AddElementL(_L8("child1"));
       
  2325     pElement->AddElementL(_L8("child2"));
       
  2326     pElement->SetContentL(_L8("element content"));
       
  2327     pElement->AddNamespaceL(_L8("a"),_L8("nsuri"));
       
  2328     CSenBaseElement* pCopied=CSenBaseElement::NewL(_L8("copied element"));
       
  2329     CleanupStack::PushL(pCopied);
       
  2330     pCopied->SetContentL(_L8("copy content"));
       
  2331     pCopied->AddElementL(_L8("child1"));
       
  2332     pCopied->AddNamespaceL(_L8("a"),_L8("nsuri"));
       
  2333     pCopied->CopyFromL(*pElement);
       
  2334     const TDesC8& content=pCopied->Content();
       
  2335     const RPointerArray<CSenElement>& copElList=pCopied->ElementsL();
       
  2336     const RPointerArray<CSenNamespace>& copNSList=pCopied->NamespacesL();
       
  2337     if(copElList.Count()==3 && copNSList.Count()==2)
       
  2338     	Flag=1;
       
  2339     else
       
  2340     	Flag=0;
       
  2341     /*EUNIT_ASSERT( Flag );*/
       
  2342     if(!Flag)
       
  2343     return KErrArgument;   
       
  2344     
       
  2345     CleanupStack::PopAndDestroy(pCopied);
       
  2346     CleanupStack::PopAndDestroy(pElement);
       
  2347     Teardown();
       
  2348     return KErrNone;
       
  2349     }
       
  2350 
       
  2351 TInt CSenXmlBCTest::CSenBaseElement_DetachLL (TTestResult& aResult)
       
  2352     {
       
  2353     SetupL();
       
  2354     CSenBaseElement* pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2355     CleanupStack::PushL(pParent);
       
  2356     CSenBaseElement* pElement1=CSenBaseElement::NewL(_L8("Element1"));
       
  2357     CleanupStack::PushL(pElement1);
       
  2358     pElement1->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  2359     pElement1->SetContentL(_L8("old content"));
       
  2360     CSenBaseElement* pElement2=CSenBaseElement::NewL(_L8("Element2"));
       
  2361     CleanupStack::PushL(pElement2);
       
  2362     CSenBaseElement* pElement3=CSenBaseElement::NewL(_L8("Element3"));
       
  2363     CleanupStack::PushL(pElement3);
       
  2364     CSenBaseElement* pElement4=CSenBaseElement::NewL(_L8("Element4"));
       
  2365     CleanupStack::PushL(pElement4);
       
  2366     pParent->AddElementL(*pElement1);
       
  2367     pParent->AddElementL(*pElement2);
       
  2368     pParent->AddElementL(*pElement3);
       
  2369     pParent->AddElementL(*pElement4); 
       
  2370     CSenElement* dElement=pElement1->DetachL();
       
  2371     const RPointerArray<CSenElement>& elList=pParent->ElementsL();
       
  2372     /*EUNIT_ASSERT( elList.Count()==3 );*/
       
  2373 	if(!(elList.Count()==3))
       
  2374     return KErrArgument;
       
  2375 
       
  2376     CleanupStack::Pop(4);
       
  2377     CleanupStack::PopAndDestroy(pParent);
       
  2378     delete dElement;
       
  2379     Teardown();
       
  2380     return KErrNone;
       
  2381     }
       
  2382 
       
  2383 TInt CSenXmlBCTest::CSenBaseElement_ChildL (TTestResult& aResult)
       
  2384     {
       
  2385     SetupL();
       
  2386     TBool FFlag,TFlag;
       
  2387     CSenBaseElement*pParent=CSenBaseElement::NewL(_L8("parent"));
       
  2388     CleanupStack::PushL(pParent);
       
  2389     pParent->AddElementL(_L8("element1"));
       
  2390     pParent->AddElementL(_L8("element2"));
       
  2391     pParent->AddElementL(_L8("element3"));
       
  2392     CSenElement* pElement=pParent->Child(0);
       
  2393     if(pElement->LocalName()==_L8("element1"))
       
  2394     	TFlag=1;
       
  2395     else
       
  2396     	TFlag=0;
       
  2397     /*EUNIT_ASSERT( TFlag );*/
       
  2398 	if(!TFlag)
       
  2399     return KErrArgument;
       
  2400     
       
  2401     CSenElement* pElement1=pParent->Child(4);
       
  2402     if(pElement1==NULL)
       
  2403     	FFlag=1;
       
  2404     else
       
  2405     	FFlag=0;
       
  2406     /*EUNIT_ASSERT( FFlag );*/
       
  2407     if(!FFlag)
       
  2408     return KErrArgument;    
       
  2409     
       
  2410     CleanupStack::PopAndDestroy(pParent);
       
  2411     Teardown();
       
  2412     return KErrNone;
       
  2413     }
       
  2414     
       
  2415 TInt CSenXmlBCTest::CSenBaseElement_SetL (TTestResult& aResult)
       
  2416     {
       
  2417     SetupL();
       
  2418     TBool Flag;
       
  2419     CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("nokia"));
       
  2420     CleanupStack::PushL(pElement);
       
  2421     pElement->Set(_L8("nsuri"),_L8("element"),_L8("e:e:lement"));
       
  2422     if(pElement->LocalName()==_L8("element") && pElement->NamespaceURI()==_L8("nsuri") 
       
  2423     		&& pElement->NsPrefix()==_L8("e"))
       
  2424     		Flag=1;
       
  2425     else
       
  2426     		Flag=0;
       
  2427     
       
  2428         /*EUNIT_ASSERT( Flag );*/
       
  2429     if(!Flag)
       
  2430     return KErrArgument;   
       
  2431 
       
  2432     if(!Flag)
       
  2433     return KErrArgument;    
       
  2434     
       
  2435     CleanupStack::PopAndDestroy(pElement);
       
  2436     Teardown();
       
  2437     return KErrNone;
       
  2438     }    
       
  2439   
       
  2440 TInt CSenXmlBCTest::CSenBaseElement_AddAttributesLL (TTestResult& aResult)
       
  2441     {
       
  2442     SetupL();
       
  2443     RStringPool stringPool;
       
  2444     stringPool.OpenL();
       
  2445     CleanupClosePushL(stringPool);
       
  2446     
       
  2447     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  2448     CleanupClosePushL(nsUriRString);
       
  2449     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  2450     CleanupClosePushL(nsPrefixRString);
       
  2451     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  2452     CleanupClosePushL(localNameRString);
       
  2453     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  2454     CleanupClosePushL(valueRString);
       
  2455     
       
  2456     RAttribute attribute;
       
  2457     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  2458                    valueRString);
       
  2459     CleanupStack::Pop(4); 
       
  2460     CleanupClosePushL(attribute);
       
  2461 
       
  2462     RAttributeArray attrArray;
       
  2463     attrArray.AppendL(attribute);
       
  2464     CleanupClosePushL(attrArray); 
       
  2465       
       
  2466     CSenBaseElement *pElement = CSenBaseElement::NewL(_L8("Nokia"));
       
  2467     CleanupStack::PushL(pElement);
       
  2468     pElement->AddAttributesL(attrArray);
       
  2469     HBufC8* pElementBuf = pElement->AsXmlL();
       
  2470     /*EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/
       
  2471     if(!(*pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" )))
       
  2472     return KErrArgument;    
       
  2473 
       
  2474 	CleanupStack::PopAndDestroy(pElement);
       
  2475 	CleanupStack::PopAndDestroy(&attrArray);
       
  2476     CleanupStack::PopAndDestroy(&attribute);
       
  2477     CleanupStack::PopAndDestroy(&stringPool);
       
  2478 	delete pElementBuf;
       
  2479     Teardown();
       
  2480     return KErrNone;
       
  2481     }
       
  2482 
       
  2483 TInt CSenXmlBCTest::CSenBaseElement_AsElementL(TTestResult& aResult)
       
  2484 	{
       
  2485     SetupL();
       
  2486 	CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  2487 	CleanupStack::PushL(pElement);
       
  2488 	pElement->AddElementL(_L8("webservices"));
       
  2489 	MSenElement* pAsElement=pElement->AsElement();
       
  2490 	HBufC8* pElementBuf=pElement->AsXmlL();
       
  2491 /*	EUNIT_ASSERT_EQUALS(*pElementBuf,_L8("<Nokia><webservices/></Nokia>"));*/
       
  2492 	TL(*pElementBuf == _L8("<Nokia><webservices/></Nokia>"));
       
  2493 	CleanupStack::PopAndDestroy(pElement);
       
  2494 	delete pElementBuf;
       
  2495 	Teardown();
       
  2496     return KErrNone;
       
  2497     }
       
  2498 	
       
  2499 TInt CSenXmlBCTest::CSenBaseElement_ContentWriteStreamLL(TTestResult& aResult)
       
  2500 	{
       
  2501     SetupL();
       
  2502 	TBuf8<50> StreamBuf;
       
  2503 	CSenBaseElement* pElement=CSenBaseElement::NewL(_L8("Nokia"));
       
  2504 	CleanupStack::PushL(pElement);
       
  2505 	pElement->AddElementL(_L8("webservices"));
       
  2506 	RWriteStream& ElemntStream=pElement->ContentWriteStreamL();
       
  2507 	TRAPD(res,ElemntStream.WriteL(StreamBuf));
       
  2508 	CleanupStack::PopAndDestroy(pElement);
       
  2509 	//EUNIT_ASSERT(FALSE);
       
  2510 	Teardown();
       
  2511     return KErrNone;
       
  2512     }
       
  2513 	
       
  2514 TInt CSenXmlBCTest::CSenBaseElement_RemoveAttributeLL(TTestResult& aResult)
       
  2515 	{
       
  2516     SetupL();/*
       
  2517     RStringPool stringPool;
       
  2518     stringPool.OpenL();
       
  2519     CleanupClosePushL(stringPool);
       
  2520     
       
  2521     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  2522     CleanupClosePushL(nsUriRString);
       
  2523     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  2524     CleanupClosePushL(nsPrefixRString);
       
  2525     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  2526     CleanupClosePushL(localNameRString);
       
  2527     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  2528     CleanupClosePushL(valueRString);
       
  2529     
       
  2530     RAttribute attribute;
       
  2531     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  2532                    valueRString);
       
  2533     CleanupStack::Pop(4); 
       
  2534     CleanupClosePushL(attribute);
       
  2535 
       
  2536     RAttributeArray attrArray;
       
  2537     attrArray.AppendL(attribute);
       
  2538     CleanupClosePushL(attrArray); 
       
  2539       
       
  2540     CSenBaseElement *pElement = CSenBaseElement::NewL(_L8("Nokia"));
       
  2541     CleanupStack::PushL(pElement);
       
  2542     pElement->AddAttributesL(attrArray);
       
  2543     CSenBaseAttribute* RmdElement=pElement->RemoveAttributeL(_L8("pr:LocalName"));
       
  2544     HBufC8* pElementBuf = pElement->AsXmlL();
       
  2545     RPointerArray<CSenBaseAttribute>& AttrList=pElement->AttributesL();
       
  2546     //EUNIT_ASSERT( *pElementBuf == _L8("<Nokia/>" ));
       
  2547     if(!(*pElementBuf == _L8("<Nokia/>")))
       
  2548     return KErrArgument;   
       
  2549 
       
  2550     //EUNIT_ASSERT_EQUALS(AttrList.Count(),0);
       
  2551     TL(AttrList.Count() == 0);
       
  2552    	CleanupStack::PopAndDestroy(pElement);
       
  2553 	CleanupStack::PopAndDestroy(&attrArray);
       
  2554     CleanupStack::PopAndDestroy(&attribute);
       
  2555     CleanupStack::PopAndDestroy(&stringPool);
       
  2556 	delete pElementBuf;
       
  2557 	delete RmdElement;
       
  2558 	//EUNIT_ASSERT(FALSE);
       
  2559 	Teardown();
       
  2560     return KErrNone;
       
  2561     */
       
  2562    	Teardown();
       
  2563     return KErrNone;
       
  2564 
       
  2565     }
       
  2566 	
       
  2567 TInt CSenXmlBCTest::CSenXmlElement_NewLL (TTestResult& aResult)
       
  2568     {
       
  2569     SetupL();
       
  2570     TBool Flag;
       
  2571     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("elment"));
       
  2572     CleanupStack::PushL(pElement);
       
  2573     if(pElement!=NULL)
       
  2574     	Flag=1;
       
  2575     else
       
  2576     	Flag=0;
       
  2577 /*EUNIT_ASSERT( Flag );*/
       
  2578     if(!Flag)
       
  2579     return KErrArgument;   
       
  2580         
       
  2581     CleanupStack::PopAndDestroy(pElement);
       
  2582     Teardown();
       
  2583     return KErrNone;
       
  2584     }
       
  2585 
       
  2586 TInt CSenXmlBCTest::CSenXmlElement_NewL_1L (TTestResult& aResult)
       
  2587     {
       
  2588     SetupL();
       
  2589     TBool Flag;
       
  2590     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"));
       
  2591     CleanupStack::PushL(pElement);
       
  2592     if(pElement!=NULL)
       
  2593     	Flag=1;
       
  2594     else
       
  2595     	Flag=0;
       
  2596     /*EUNIT_ASSERT( Flag );*/
       
  2597     if(!Flag)
       
  2598     return KErrArgument;   
       
  2599     
       
  2600     CleanupStack::PopAndDestroy(pElement);
       
  2601     Teardown();
       
  2602     return KErrNone;
       
  2603     }
       
  2604 
       
  2605 TInt CSenXmlBCTest::CSenXmlElement_NewL_2L (TTestResult& aResult)
       
  2606     {
       
  2607     SetupL();
       
  2608     TBool Flag;
       
  2609     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element"));
       
  2610     CleanupStack::PushL(pElement);
       
  2611     if(pElement!=NULL)
       
  2612     	Flag=1;
       
  2613     else
       
  2614     	Flag=0;
       
  2615    /*EUNIT_ASSERT( Flag );*/
       
  2616     if(!Flag)
       
  2617     return KErrArgument;   
       
  2618     
       
  2619     CleanupStack::PopAndDestroy(pElement);
       
  2620     Teardown();
       
  2621     return KErrNone;
       
  2622     }
       
  2623 
       
  2624 TInt CSenXmlBCTest::CSenXmlElement_SetAttributesLL (TTestResult& aResult)
       
  2625     {
       
  2626     SetupL();
       
  2627     RStringPool stringPool;
       
  2628     stringPool.OpenL();
       
  2629     CleanupClosePushL(stringPool);
       
  2630     
       
  2631     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  2632     CleanupClosePushL(nsUriRString);
       
  2633     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  2634     CleanupClosePushL(nsPrefixRString);
       
  2635     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  2636     CleanupClosePushL(localNameRString);
       
  2637     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  2638     CleanupClosePushL(valueRString);
       
  2639     
       
  2640     RAttribute attribute;
       
  2641     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  2642                    valueRString);
       
  2643     CleanupStack::Pop(4); 
       
  2644     CleanupClosePushL(attribute);
       
  2645 
       
  2646     RAttributeArray attrArray;
       
  2647     attrArray.AppendL(attribute);
       
  2648     CleanupClosePushL(attrArray); 
       
  2649       
       
  2650     CSenXmlElement *pElement = CSenXmlElement::NewL(_L8("Nokia"));
       
  2651     CleanupStack::PushL(pElement);
       
  2652     pElement->SetAttributesL(attrArray);
       
  2653     HBufC8* pElementBuf = pElement->AsXmlL();
       
  2654 /*    EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/
       
  2655     if(!( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" )))
       
  2656     return KErrArgument;   
       
  2657 
       
  2658 	CleanupStack::PopAndDestroy(pElement);
       
  2659 	CleanupStack::PopAndDestroy(&attrArray);
       
  2660     CleanupStack::PopAndDestroy(&attribute);
       
  2661     CleanupStack::PopAndDestroy(&stringPool);
       
  2662 	delete pElementBuf;
       
  2663     Teardown();
       
  2664     return KErrNone;
       
  2665     }
       
  2666 
       
  2667 TInt CSenXmlBCTest::CSenXmlElement_LocalNameL (TTestResult& aResult)
       
  2668     {
       
  2669     SetupL();
       
  2670     TBool Flag;
       
  2671     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element"));
       
  2672     CleanupStack::PushL(pElement);
       
  2673     const TDesC8& lName=pElement->LocalName();
       
  2674     if(lName==_L8("element"))
       
  2675     	Flag=1;
       
  2676     else
       
  2677     	Flag=0;
       
  2678    /*EUNIT_ASSERT( Flag );*/
       
  2679     if(!Flag)
       
  2680     return KErrArgument;   
       
  2681    
       
  2682     CleanupStack::PopAndDestroy(pElement);
       
  2683     Teardown();
       
  2684     return KErrNone;
       
  2685     }
       
  2686 
       
  2687 TInt CSenXmlBCTest::CSenXmlElement_NamespaceURIL (TTestResult& aResult)
       
  2688     {
       
  2689     SetupL();
       
  2690     TBool Flag;
       
  2691     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element"));
       
  2692     CleanupStack::PushL(pElement);
       
  2693     const TDesC8& nsURI=pElement->NamespaceURI();
       
  2694     if(nsURI==_L8("nsuria"))
       
  2695     	Flag=1;
       
  2696     else
       
  2697     	Flag=0;
       
  2698    /*EUNIT_ASSERT( Flag );*/
       
  2699     if(!Flag)
       
  2700     return KErrArgument;   
       
  2701     
       
  2702     CleanupStack::PopAndDestroy(pElement);
       
  2703     Teardown();
       
  2704     return KErrNone;
       
  2705     }
       
  2706 
       
  2707 TInt CSenXmlBCTest::CSenXmlElement_NsPrefixL (TTestResult& aResult)
       
  2708     {
       
  2709     SetupL(); 
       
  2710     TBool Flag;
       
  2711     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"),_L8("a:element"));
       
  2712     CleanupStack::PushL(pElement);
       
  2713     const TDesC8& nsPrefix=pElement->NsPrefix();
       
  2714     if(nsPrefix==_L8("a"))
       
  2715     	Flag=1;
       
  2716     else
       
  2717     	Flag=0;
       
  2718         /*EUNIT_ASSERT( Flag );*/
       
  2719     if(!Flag)
       
  2720     return KErrArgument;   
       
  2721 
       
  2722     CleanupStack::PopAndDestroy(pElement);
       
  2723     Teardown();
       
  2724     return KErrNone;
       
  2725     }
       
  2726 
       
  2727 TInt CSenXmlBCTest::CSenXmlElement_SetPrefixLL (TTestResult& aResult)
       
  2728     {
       
  2729     SetupL();//some thing
       
  2730     TBool Flag;
       
  2731     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("element"));
       
  2732     CleanupStack::PushL(pElement);
       
  2733     pElement->SetPrefixL(_L8("pre"));
       
  2734     const TDesC8& lName=pElement->LocalName();
       
  2735     const TDesC8& nsPrefix=pElement->NsPrefix();
       
  2736     if(nsPrefix==_L8("pre") && lName==_L8("element"))
       
  2737     	Flag=1;
       
  2738     else
       
  2739     	Flag=0;
       
  2740         /*EUNIT_ASSERT( Flag );*/
       
  2741     if(!Flag)
       
  2742     return KErrArgument;   
       
  2743 
       
  2744     CleanupStack::PopAndDestroy(pElement);
       
  2745   
       
  2746     Teardown();
       
  2747     return KErrNone;
       
  2748     }
       
  2749 
       
  2750 TInt CSenXmlBCTest::CSenXmlElement_HasContentL (TTestResult& aResult)
       
  2751     {
       
  2752     SetupL();
       
  2753     TBool Flag;
       
  2754     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element"));
       
  2755     CleanupStack::PushL(pElement);
       
  2756     //False case
       
  2757     Flag=pElement->HasContent();
       
  2758 /*    EUNIT_ASSERT( !Flag );*/
       
  2759   	if(Flag)
       
  2760     return KErrArgument;  
       
  2761 
       
  2762     //True case
       
  2763     pElement->SetContentL(_L8("CONTENT"));
       
  2764     Flag=pElement->HasContent();
       
  2765         /*EUNIT_ASSERT( Flag );*/
       
  2766     if(!Flag)
       
  2767     return KErrArgument;   
       
  2768 
       
  2769     CleanupStack::PopAndDestroy(pElement);
       
  2770     Teardown();
       
  2771     return KErrNone;
       
  2772     }
       
  2773 
       
  2774 TInt CSenXmlBCTest::CSenXmlElement_ContentL (TTestResult& aResult)
       
  2775     {
       
  2776     SetupL();
       
  2777     TBool Flag;
       
  2778     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element"));
       
  2779     CleanupStack::PushL(pElement);
       
  2780     pElement->SetContentL(_L8("CONTENT"));
       
  2781     const TDesC8& content=pElement->Content();
       
  2782     if(content==_L8("CONTENT"))
       
  2783     	Flag=1;
       
  2784     else
       
  2785     	Flag=0;
       
  2786         /*EUNIT_ASSERT( Flag );*/
       
  2787     if(!Flag)
       
  2788     return KErrArgument;   
       
  2789 
       
  2790     CleanupStack::PopAndDestroy(pElement);
       
  2791     Teardown();
       
  2792     return KErrNone;
       
  2793     }
       
  2794     
       
  2795 TInt CSenXmlBCTest::CSenXmlElement_ContentWriteStreamLL (TTestResult& aResult)
       
  2796     {
       
  2797     SetupL();
       
  2798     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element"));
       
  2799     CleanupStack::PushL(pElement);
       
  2800 	RWriteStream stream = pElement->ContentWriteStreamL();
       
  2801     CleanupStack::PopAndDestroy(pElement);
       
  2802     Teardown();
       
  2803     return KErrNone;
       
  2804     }
       
  2805     
       
  2806 
       
  2807 TInt CSenXmlBCTest::CSenXmlElement_ContentUnicodeLL (TTestResult& aResult)
       
  2808     {
       
  2809     SetupL();    
       
  2810     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nsuria"),_L8("Nokia"),_L8("N:Nokia"));
       
  2811     CleanupStack::PushL(pElement);
       
  2812 	pElement->SetContentL(_L8("Nokia content"));
       
  2813 	HBufC* ElementBuf=pElement->ContentUnicodeL();
       
  2814 /*	EUNIT_ASSERT_EQUALS(*ElementBuf,_L("Nokia content"));*/
       
  2815 	TL(*ElementBuf == _L("Nokia content"));
       
  2816 	CleanupStack::PopAndDestroy(pElement);
       
  2817 	delete ElementBuf;
       
  2818     Teardown();
       
  2819     return KErrNone;
       
  2820     }
       
  2821 
       
  2822 TInt CSenXmlBCTest::CSenXmlElement_SetContentLL (TTestResult& aResult)
       
  2823     {
       
  2824     SetupL();
       
  2825     TBool Flag;
       
  2826     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element"));
       
  2827     CleanupStack::PushL(pElement);
       
  2828     pElement->SetContentL(_L8("CONTENT"));
       
  2829     TBool ContentFlag=pElement->HasContent();
       
  2830     const TDesC8& content=pElement->Content();
       
  2831     if(content==_L8("CONTENT") && ContentFlag)
       
  2832    		Flag=1;
       
  2833     else 
       
  2834     	Flag=0;
       
  2835         /*EUNIT_ASSERT( Flag );*/
       
  2836     if(!Flag)
       
  2837     return KErrArgument;   
       
  2838 
       
  2839     pElement->SetContentL(_L8("NEW CONTENT"));
       
  2840     const TDesC8& newContent=pElement->Content();
       
  2841     if(newContent==_L8("NEW CONTENT") )
       
  2842    		Flag=1;
       
  2843     else 
       
  2844     	Flag=0;
       
  2845         /*EUNIT_ASSERT( Flag );*/
       
  2846     if(!Flag)
       
  2847     return KErrArgument;   
       
  2848 
       
  2849     CleanupStack::PopAndDestroy(pElement);
       
  2850     Teardown();
       
  2851     return KErrNone;
       
  2852     }
       
  2853 
       
  2854 TInt CSenXmlBCTest::CSenXmlElement_ConsistsOfLL (TTestResult& aResult)
       
  2855     {
       
  2856     SetupL();
       
  2857     CSenXmlElement* pElementA=CSenXmlElement::NewL(_L8("Nokia"));
       
  2858     CleanupStack::PushL(pElementA);
       
  2859     CSenXmlElement* pChild1A=CSenXmlElement::NewL(_L8("Asp"));
       
  2860     CleanupStack::PushL(pChild1A);
       
  2861     CSenXmlElement* pChild2A=CSenXmlElement::NewL(_L8("WebServices"));
       
  2862     CleanupStack::PushL(pChild2A);
       
  2863     pElementA->SetContentL(_L8("Nokia organisation structure"));
       
  2864     pElementA->AddElementL(*pChild1A);
       
  2865     pElementA->AddElementL(*pChild2A);
       
  2866     
       
  2867     CSenXmlElement* pElementB=CSenXmlElement::NewL(_L8("Nokia"));
       
  2868     CleanupStack::PushL(pElementB);
       
  2869     CSenXmlElement* pChild1B=CSenXmlElement::NewL(_L8("Asp"));
       
  2870     CleanupStack::PushL(pChild1A);
       
  2871     CSenXmlElement* pChild2B=CSenXmlElement::NewL(_L8("WebServices"));
       
  2872     CleanupStack::PushL(pChild2B);
       
  2873     pElementB->SetContentL(_L8("Nokia organisation structure"));
       
  2874     pElementB->AddElementL(*pChild1B);
       
  2875     pElementB->AddElementL(*pChild2B);
       
  2876     
       
  2877     TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA);
       
  2878 /*    EUNIT_ASSERT( ConsistOfFlag );*/
       
  2879     if(!ConsistOfFlag)
       
  2880     return KErrArgument;   
       
  2881     
       
  2882     CleanupStack::Pop(2);
       
  2883     CleanupStack::PopAndDestroy(pElementB);
       
  2884     CleanupStack::Pop(2);
       
  2885     CleanupStack::PopAndDestroy(pElementA);
       
  2886     Teardown();
       
  2887     return KErrNone;
       
  2888     }
       
  2889     
       
  2890 TInt CSenXmlBCTest::CSenXmlElement_ConsistsOfL1L (TTestResult& aResult)
       
  2891     {
       
  2892     SetupL();
       
  2893     CSenXmlElement* pElementA=CSenXmlElement::NewL(_L8("Nokia"));
       
  2894     CleanupStack::PushL(pElementA);
       
  2895     CSenXmlElement* pChild1A=CSenXmlElement::NewL(_L8("Asp"));
       
  2896     CleanupStack::PushL(pChild1A);
       
  2897     CSenXmlElement* pChild2A=CSenXmlElement::NewL(_L8("WebServices"));
       
  2898     CleanupStack::PushL(pChild2A);
       
  2899     pElementA->SetContentL(_L8("Nokia organisation structure"));
       
  2900     pElementA->AddElementL(*pChild1A);
       
  2901     pElementA->AddElementL(*pChild2A);
       
  2902     
       
  2903     CSenXmlElement* pElementB=CSenXmlElement::NewL(_L8("Nokia"));
       
  2904     CleanupStack::PushL(pElementB);
       
  2905     CSenXmlElement* pChild1B=CSenXmlElement::NewL(_L8("Asp"));
       
  2906     CleanupStack::PushL(pChild1A);
       
  2907     CSenXmlElement* pChild2B=CSenXmlElement::NewL(_L8("Xml"));
       
  2908     CleanupStack::PushL(pChild2B);
       
  2909     pElementB->SetContentL(_L8("Nokia organisation structure"));
       
  2910     pElementB->AddElementL(*pChild1B);
       
  2911     pElementB->AddElementL(*pChild2B);
       
  2912     
       
  2913     TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA);
       
  2914 /*    EUNIT_ASSERT( !ConsistOfFlag );*/
       
  2915     if(ConsistOfFlag)
       
  2916     return KErrArgument;   
       
  2917 
       
  2918     CleanupStack::Pop(2);
       
  2919     CleanupStack::PopAndDestroy(pElementB);
       
  2920     CleanupStack::Pop(2);
       
  2921     CleanupStack::PopAndDestroy(pElementA);
       
  2922 	Teardown();
       
  2923     return KErrNone;
       
  2924     }
       
  2925 	
       
  2926 TInt CSenXmlBCTest::CSenXmlElement_ConsistsOfL2L (TTestResult& aResult)
       
  2927     {
       
  2928     SetupL();
       
  2929     CSenXmlElement* pElementA=CSenXmlElement::NewL(_L8("Nokia"));
       
  2930     CleanupStack::PushL(pElementA);
       
  2931     CSenXmlElement* pChild1A=CSenXmlElement::NewL(_L8("Asp"));
       
  2932     CleanupStack::PushL(pChild1A);
       
  2933     CSenXmlElement* pChild2A=CSenXmlElement::NewL(_L8("WebServices"));
       
  2934     CleanupStack::PushL(pChild2A);
       
  2935     CSenXmlElement* pChild3A=CSenXmlElement::NewL(_L8("Xml"));
       
  2936     CleanupStack::PushL(pChild3A);
       
  2937     pElementA->SetContentL(_L8("Nokia organisation structure"));
       
  2938     pElementA->AddElementL(*pChild1A);
       
  2939     pElementA->AddElementL(*pChild2A);
       
  2940     pElementA->AddElementL(*pChild3A);
       
  2941     
       
  2942     CSenXmlElement* pElementB=CSenXmlElement::NewL(_L8("Nokia"));
       
  2943     CleanupStack::PushL(pElementB);
       
  2944     CSenXmlElement* pChild1B=CSenXmlElement::NewL(_L8("Asp"));
       
  2945     CleanupStack::PushL(pChild1A);
       
  2946     CSenXmlElement* pChild2B=CSenXmlElement::NewL(_L8("Xml"));
       
  2947     CleanupStack::PushL(pChild2B);
       
  2948     pElementB->SetContentL(_L8("Nokia organisation structure"));
       
  2949     pElementB->AddElementL(*pChild1B);
       
  2950     pElementB->AddElementL(*pChild2B);
       
  2951     
       
  2952     TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA);
       
  2953 /*    EUNIT_ASSERT( ConsistOfFlag );*/
       
  2954     if(!ConsistOfFlag)
       
  2955     return KErrArgument;   
       
  2956 
       
  2957     CleanupStack::Pop(3);
       
  2958     CleanupStack::PopAndDestroy(pElementB);
       
  2959     CleanupStack::Pop(2);
       
  2960     CleanupStack::PopAndDestroy(pElementA);
       
  2961 	Teardown();
       
  2962     return KErrNone;
       
  2963     }	
       
  2964 
       
  2965 TInt CSenXmlBCTest::CSenXmlElement_SetNamespaceLL (TTestResult& aResult)
       
  2966     {
       
  2967     SetupL();
       
  2968     TBool Flag;
       
  2969     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  2970     CleanupStack::PushL(pElement);
       
  2971     pElement->SetNamespaceL(_L8("namespaceuri"));
       
  2972 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  2973 	if(pNsURI==_L8("namespaceuri"))
       
  2974 		Flag=1;
       
  2975 	else
       
  2976 		Flag=0;
       
  2977 	CleanupStack::PopAndDestroy(pElement);
       
  2978         /*EUNIT_ASSERT( Flag );*/
       
  2979     if(!Flag)
       
  2980     return KErrArgument;   
       
  2981 
       
  2982     Teardown();
       
  2983     return KErrNone;
       
  2984     }
       
  2985     
       
  2986 TInt CSenXmlBCTest::CSenXmlElement_SetNamespaceL_1L (TTestResult& aResult)
       
  2987     {
       
  2988     SetupL();
       
  2989     TBool Flag;
       
  2990     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  2991     CleanupStack::PushL(pElement);
       
  2992     pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  2993 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  2994 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  2995 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  2996 		Flag=1;
       
  2997 	else
       
  2998 		Flag=0;
       
  2999 	CleanupStack::PopAndDestroy(pElement);
       
  3000         /*EUNIT_ASSERT( Flag );*/
       
  3001     if(!Flag)
       
  3002     return KErrArgument;   
       
  3003 
       
  3004     Teardown();
       
  3005     return KErrNone;
       
  3006     }
       
  3007 TInt CSenXmlBCTest::CSenXmlElement_SetNamespaceL_2same1L (TTestResult& aResult)
       
  3008     {
       
  3009     SetupL();
       
  3010      TBool Flag;
       
  3011     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3012     CleanupStack::PushL(pElement);
       
  3013     pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  3014     pElement->SetNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  3015 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  3016 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  3017 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  3018 		Flag=1;
       
  3019 	else
       
  3020 		Flag=0;
       
  3021         /*EUNIT_ASSERT( Flag );*/
       
  3022     if(!Flag)
       
  3023     return KErrArgument;   
       
  3024 
       
  3025 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  3026 /* 	EUNIT_ASSERT( pNsList.Count()==1 );*/
       
  3027     if(!( pNsList.Count()==1 ))
       
  3028     return KErrArgument;   
       
  3029 
       
  3030 	CleanupStack::PopAndDestroy(pElement); 
       
  3031     Teardown();
       
  3032     return KErrNone;
       
  3033     }    
       
  3034  
       
  3035 TInt CSenXmlBCTest::CSenXmlElement_SetNamespaceL_2Diff1L (TTestResult& aResult)
       
  3036     {
       
  3037     SetupL();
       
  3038      TBool Flag;
       
  3039     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3040     CleanupStack::PushL(pElement);
       
  3041     pElement->SetNamespaceL(_L8("N1"),_L8("namespaceuri1"));
       
  3042     pElement->SetNamespaceL(_L8("N2"),_L8("namespaceuri2"));
       
  3043 	const TDesC8& pNsURI=pElement->NamespaceURI();
       
  3044 	const TDesC8& pNsPrefix=pElement->NsPrefix();
       
  3045 	if(pNsURI==_L8("namespaceuri2")&&pNsPrefix==_L8("N2"))
       
  3046 		Flag=1;
       
  3047 	else
       
  3048 		Flag=0;
       
  3049         /*EUNIT_ASSERT( Flag );*/
       
  3050     if(!Flag)
       
  3051     return KErrArgument;   
       
  3052 
       
  3053 	RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  3054 /* 	EUNIT_ASSERT( pNsList.Count()==2 );*/
       
  3055     if(!( pNsList.Count()==2 ))
       
  3056     return KErrArgument;   
       
  3057 
       
  3058  	CleanupStack::PopAndDestroy(pElement);
       
  3059     Teardown();
       
  3060     return KErrNone;
       
  3061     }    
       
  3062 
       
  3063 TInt CSenXmlBCTest::CSenXmlElement_AddNamespaceLL (TTestResult& aResult)
       
  3064     {
       
  3065     SetupL();
       
  3066     TBool Flag;
       
  3067     TBool CheckParent=TRUE;
       
  3068     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3069     CleanupStack::PushL(pElement);
       
  3070     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("ParentElement"));
       
  3071     CleanupStack::PushL(pParent);
       
  3072     
       
  3073     pElement->SetParent(pParent);
       
  3074     CSenNamespace* pNs1=CSenNamespace::NewL(_L8("N"),_L8("namespaceuri"));
       
  3075     CleanupStack::PushL(pNs1);
       
  3076     const CSenNamespace* pNs=pElement->AddNamespaceL(*pNs1,CheckParent);
       
  3077     RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  3078 	const TDesC8& pNsURI=pNs->URI();
       
  3079 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  3080 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  3081 		Flag=1;
       
  3082 	else
       
  3083 		Flag=0;
       
  3084 	
       
  3085         /*EUNIT_ASSERT( Flag );*/
       
  3086     if(!Flag)
       
  3087     return KErrArgument;   
       
  3088 
       
  3089 /*    EUNIT_ASSERT( pNsList.Count()==1);*/
       
  3090     if(!( pNsList.Count()==1 ))
       
  3091     return KErrArgument;   
       
  3092 
       
  3093    	CleanupStack::PopAndDestroy(pNs1);
       
  3094    	CleanupStack::PopAndDestroy(pParent);	
       
  3095 	CleanupStack::PopAndDestroy(pElement);
       
  3096     Teardown();
       
  3097     return KErrNone;
       
  3098     }
       
  3099 
       
  3100 TInt CSenXmlBCTest::CSenXmlElement_AddNamespaceL_1L (TTestResult& aResult)
       
  3101     {
       
  3102     SetupL();
       
  3103     TBool Flag;
       
  3104     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3105     CleanupStack::PushL(pElement);
       
  3106     const CSenNamespace* pNs=pElement->AddNamespaceL(_L8("N"),_L8("namespaceuri"));
       
  3107 	const TDesC8& pNsURI=pNs->URI();
       
  3108 	const TDesC8& pNsPrefix=pNs->Prefix();
       
  3109 	if(pNsURI==_L8("namespaceuri")&&pNsPrefix==_L8("N"))
       
  3110 		Flag=1;
       
  3111 	else
       
  3112 		Flag=0;
       
  3113 	CleanupStack::PopAndDestroy(pElement);
       
  3114         /*EUNIT_ASSERT( Flag );*/
       
  3115     if(!Flag)
       
  3116     return KErrArgument;   
       
  3117 
       
  3118     Teardown();
       
  3119     return KErrNone;
       
  3120     }
       
  3121 
       
  3122 TInt CSenXmlBCTest::CSenXmlElement_NamespaceL (TTestResult& aResult)
       
  3123     {
       
  3124     SetupL();
       
  3125     TBool Flag,Flag1,Flag2;
       
  3126     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3127     CleanupStack::PushL(pElement);
       
  3128     //NULL
       
  3129     pElement->SetNamespaceL(_L8(""));
       
  3130     const CSenNamespace* pNs2=pElement->Namespace();
       
  3131     if(pNs2==NULL)
       
  3132     	Flag2=1;
       
  3133     else
       
  3134     	Flag2=0;
       
  3135 /*    EUNIT_ASSERT(Flag2);*/
       
  3136     if(!Flag2)
       
  3137     return KErrArgument;   
       
  3138    
       
  3139    
       
  3140     //only URI
       
  3141     pElement->SetNamespaceL(_L8("nsuri"));
       
  3142     const CSenNamespace* pNs1=pElement->Namespace();
       
  3143     if(pNs1->Prefix()==_L8("")&&pNs1->URI()==_L8("nsuri"))
       
  3144     	Flag1=1;
       
  3145     else
       
  3146     	Flag1=0;
       
  3147 /*    EUNIT_ASSERT(Flag1);*/
       
  3148     if(!Flag1)
       
  3149     return KErrArgument;   
       
  3150 
       
  3151     //URI and Prefix
       
  3152     pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  3153     const CSenNamespace* pNs=pElement->Namespace();
       
  3154     if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri"))
       
  3155     	Flag=1;
       
  3156     else
       
  3157     	Flag=0;
       
  3158         /*EUNIT_ASSERT( Flag );*/
       
  3159     if(!Flag)
       
  3160     return KErrArgument;   
       
  3161 
       
  3162     CleanupStack::PopAndDestroy(pElement);
       
  3163 
       
  3164     Teardown();
       
  3165     return KErrNone;
       
  3166     }
       
  3167 
       
  3168 TInt CSenXmlBCTest::CSenXmlElement_Namespace_1L (TTestResult& aResult)
       
  3169     {
       
  3170     SetupL();
       
  3171     TBool Flag,Flag1;
       
  3172      //True case
       
  3173     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3174     CleanupStack::PushL(pElement);
       
  3175     pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  3176     const CSenNamespace* pNs=pElement->Namespace(_L8("n"));
       
  3177     if(pNs->Prefix()==_L8("n") && pNs->URI()==_L8("nsuri"))
       
  3178     	Flag=1;
       
  3179     else
       
  3180     	Flag=0;
       
  3181         /*EUNIT_ASSERT( Flag );*/
       
  3182     if(!Flag)
       
  3183     return KErrArgument;   
       
  3184 
       
  3185     CleanupStack::PopAndDestroy(pElement);
       
  3186     //False case
       
  3187     pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3188     CleanupStack::PushL(pElement);
       
  3189     pElement->SetNamespaceL(_L8("n"),_L8("nsuri"));
       
  3190     pNs=pElement->Namespace(_L8("N"));
       
  3191     if(pNs==NULL)
       
  3192     	Flag1=1;
       
  3193     else
       
  3194     	Flag1=0;
       
  3195 /*    EUNIT_ASSERT(Flag1);*/
       
  3196     if(!Flag1)
       
  3197     return KErrArgument;   
       
  3198 
       
  3199     CleanupStack::PopAndDestroy(pElement);
       
  3200     Teardown();
       
  3201     return KErrNone;
       
  3202     }
       
  3203 
       
  3204 TInt CSenXmlBCTest::CSenXmlElement_Namespace_2L (TTestResult& aResult)
       
  3205     {
       
  3206     SetupL();
       
  3207 	TBool Flag,Flag1;
       
  3208     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3209     CleanupStack::PushL(pElement);
       
  3210     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent"));
       
  3211     CleanupStack::PushL(pParent);
       
  3212     pParent->SetNamespaceL(_L8("p"),_L8("nsurip"));
       
  3213     pElement->SetNamespaceL(_L8("n"),_L8("nsurin"));
       
  3214     pElement->SetParent(pParent);
       
  3215     //aCheckInParent=FALSE and parent prefix
       
  3216     const CSenNamespace* pPNs=pElement->Namespace(_L8("p"),FALSE);
       
  3217     if(pPNs==NULL)
       
  3218     	Flag=1;
       
  3219    	else
       
  3220    		Flag=0;
       
  3221         /*EUNIT_ASSERT( Flag );*/
       
  3222     if(!Flag)
       
  3223     return KErrArgument;   
       
  3224 
       
  3225     //aCheckInParent=TRUE and parent prefix
       
  3226     pPNs=pElement->Namespace(_L8("p"),TRUE);
       
  3227     if(pPNs->Prefix()==_L8("p") && pPNs->URI()==_L8("nsurip"))
       
  3228     	Flag1=1; 
       
  3229    	else
       
  3230    		Flag1=0;
       
  3231 /*    EUNIT_ASSERT( Flag1 );*/
       
  3232     if(!Flag1)
       
  3233     return KErrArgument;   
       
  3234 
       
  3235     CleanupStack::PopAndDestroy(pParent);
       
  3236     CleanupStack::PopAndDestroy(pElement);    
       
  3237     Teardown();
       
  3238     return KErrNone;
       
  3239     }
       
  3240 
       
  3241 TInt CSenXmlBCTest::CSenXmlElement_Namespace_3L (TTestResult& aResult)
       
  3242     {
       
  3243     SetupL();
       
  3244     TBool Flag;
       
  3245     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3246     CleanupStack::PushL(pElement);
       
  3247     pElement->AddNamespaceL(_L8("n"),_L8("nsurin"));
       
  3248     pElement->AddNamespaceL(_L8("m"),_L8("nsurim"));
       
  3249     pElement->AddNamespaceL(_L8("l"),_L8("nsuril"));
       
  3250     RPointerArray<CSenNamespace>& pNsList=pElement->NamespacesL();
       
  3251 /*    EUNIT_ASSERT( pNsList.Count()==3 );*/
       
  3252     if(!( pNsList.Count()==3 ))
       
  3253     return KErrArgument;   
       
  3254 
       
  3255     const CSenNamespace* pNs=pElement->Namespace(_L8("m"),_L8("nsurim"));
       
  3256     if(pNs->Prefix()==_L8("m") && pNs->URI()==_L8("nsurim"))
       
  3257     	Flag=1;
       
  3258     else
       
  3259     	Flag=0;
       
  3260     /*EUNIT_ASSERT(Flag);*/
       
  3261     if(!Flag)
       
  3262     return KErrArgument;   
       
  3263 
       
  3264     CleanupStack::PopAndDestroy(pElement);
       
  3265     Teardown();
       
  3266     return KErrNone;
       
  3267     }
       
  3268 
       
  3269 TInt CSenXmlBCTest::CSenXmlElement_ElementsLL (TTestResult& aResult)
       
  3270     {
       
  3271     SetupL();
       
  3272     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")) ;
       
  3273     CleanupStack::PushL(pElement);
       
  3274     CSenXmlElement* pChild1=CSenXmlElement::NewL(_L8("element1")) ;
       
  3275     CleanupStack::PushL(pChild1);
       
  3276     CSenXmlElement* pChild2=CSenXmlElement::NewL(_L8("element2")) ;
       
  3277     CleanupStack::PushL(pChild2);
       
  3278     CSenXmlElement* pChild3=CSenXmlElement::NewL(_L8("element3")) ;
       
  3279     CleanupStack::PushL(pChild3);
       
  3280     pElement->AddElementL(*pChild1);
       
  3281     pElement->AddElementL(*pChild2);
       
  3282     pElement->AddElementL(*pChild3);
       
  3283     RPointerArray<CSenElement>& ElList=pElement->ElementsL();
       
  3284     /*EUNIT_ASSERT( ElList.Count()==3);*/
       
  3285     if(!( ElList.Count()==3 ))
       
  3286     return KErrArgument;  
       
  3287     
       
  3288     CleanupStack::Pop(3);
       
  3289     CleanupStack::PopAndDestroy(pElement);
       
  3290     Teardown();
       
  3291     return KErrNone;
       
  3292     }
       
  3293 
       
  3294 TInt CSenXmlBCTest::CSenXmlElement_AttributesLL (TTestResult& aResult)
       
  3295     {
       
  3296     SetupL();
       
  3297     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")) ;
       
  3298     pElement->AddAttrL(_L8("Attr1"),_L8("value1"));
       
  3299     pElement->AddAttrL(_L8("Attr2"),_L8("value2"));
       
  3300     pElement->AddAttrL(_L8("Attr3"),_L8("value3"));
       
  3301     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  3302     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  3303     RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL();
       
  3304 /*    EUNIT_ASSERT( pAttrList.Count()==4 );*/
       
  3305     if(!( pAttrList.Count()==4 ))
       
  3306     return KErrArgument;  
       
  3307     
       
  3308     delete pElement;
       
  3309     Teardown();
       
  3310     return KErrNone;
       
  3311     }
       
  3312 TInt CSenXmlBCTest::CSenXmlElement_AddAttributeLL (TTestResult& aResult)
       
  3313     {
       
  3314     SetupL();
       
  3315     CTestXmlElement* pElement=CTestXmlElement::NewL(_L8("Nokia"));
       
  3316     CleanupStack::PushL(pElement);
       
  3317     pElement->AddAttributeL(_L8("Attr1"),_L8("value1"));
       
  3318     
       
  3319     CleanupStack::PopAndDestroy(pElement);
       
  3320     Teardown();
       
  3321     return KErrNone;
       
  3322     }
       
  3323 
       
  3324 TInt CSenXmlBCTest::CSenXmlElement_NamespacesLL (TTestResult& aResult)
       
  3325     {
       
  3326     SetupL();
       
  3327     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3328     CleanupStack::PushL(pElement);
       
  3329     pElement->AddNamespaceL(_L8("l"),_L8("nsuril"));
       
  3330     pElement->AddNamespaceL(_L8("m"),_L8("nsurim"));
       
  3331     pElement->AddNamespaceL(_L8("n"),_L8("nsurin"));
       
  3332     pElement->AddNamespaceL(_L8("m"),_L8("nsurim"));
       
  3333     const RPointerArray<CSenNamespace>& pNs=pElement->NamespacesL();
       
  3334 /*    EUNIT_ASSERT( pNs.Count()==3);*/
       
  3335     if(!( pNs.Count()==3 ))
       
  3336     return KErrArgument;  
       
  3337     
       
  3338     CleanupStack::PopAndDestroy(pElement);
       
  3339     Teardown();
       
  3340     return KErrNone;
       
  3341     }
       
  3342 
       
  3343 TInt CSenXmlBCTest::CSenXmlElement_AttrValueL (TTestResult& aResult)
       
  3344     {
       
  3345     SetupL();
       
  3346     TBool Flag,NegFlag;
       
  3347     _LIT8(KValue,"value4");
       
  3348     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia")) ;
       
  3349     pElement->AddAttrL(_L8("Attr1"),_L8("value1"));
       
  3350     pElement->AddAttrL(_L8("Attr2"),_L8("value2"));
       
  3351     pElement->AddAttrL(_L8("Attr3"),_L8("value3"));
       
  3352     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  3353     pElement->AddAttrL(_L8("Attr4"),_L8("value4"));    
       
  3354     const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr4"));
       
  3355     if(pAttrVal!=NULL)
       
  3356     	Flag=1;
       
  3357     else
       
  3358     	Flag=0;
       
  3359 /*    EUNIT_ASSERT(Flag);*/
       
  3360     if(!(Flag))
       
  3361     return KErrArgument;  
       
  3362     
       
  3363     const TDesC8* pNegAttrVal=pElement->AttrValue(_L8("attr1"));
       
  3364     if(pNegAttrVal==NULL)
       
  3365     	NegFlag=1;
       
  3366     else
       
  3367     	NegFlag=0;
       
  3368     /*EUNIT_ASSERT(NegFlag);*/
       
  3369     if(!(NegFlag))
       
  3370     return KErrArgument;  
       
  3371     
       
  3372     delete pElement;
       
  3373     Teardown();
       
  3374     return KErrNone;
       
  3375     }
       
  3376 
       
  3377 TInt CSenXmlBCTest::CSenXmlElement_AddAttrLL (TTestResult& aResult)
       
  3378     {
       
  3379     SetupL();
       
  3380 	CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3381     CleanupStack::PushL(pElement);
       
  3382     pElement->AddAttrL(_L8("Attr1"),_L8("value1"));
       
  3383     RPointerArray<CSenBaseAttribute>& pAttrList=pElement->AttributesL();
       
  3384 /*    EUNIT_ASSERT( pAttrList.Count()==1 );*/
       
  3385     if(!(pAttrList.Count()==1))
       
  3386     return KErrArgument;  
       
  3387 
       
  3388     pElement->AddAttrL(_L8("Attr1"),_L8("Duplicatevalue1"));
       
  3389     /*EUNIT_ASSERT( pAttrList.Count()==1 );*/
       
  3390     if(!(pAttrList.Count()==1))
       
  3391     return KErrArgument;  
       
  3392     
       
  3393     const TDesC8* pAttrVal=pElement->AttrValue(_L8("Attr1"));
       
  3394     pElement->AddAttrL(_L8("Attr2"),_L8(" value2"));//improve here by comparing TDesC8* AttrValue()
       
  3395     /*EUNIT_ASSERT( pAttrList.Count()==2 );*/
       
  3396     if(!(pAttrList.Count()==2))
       
  3397     return KErrArgument;  
       
  3398     
       
  3399     CleanupStack::PopAndDestroy(pElement);
       
  3400     Teardown();
       
  3401     return KErrNone;
       
  3402     }
       
  3403 
       
  3404 TInt CSenXmlBCTest::CSenXmlElement_ParentL (TTestResult& aResult)
       
  3405     {
       
  3406     SetupL();
       
  3407     TBool Flag,PFlag,PPFlag;
       
  3408     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3409     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent"));
       
  3410     CSenXmlElement* pPParent=CSenXmlElement::NewL(_L8("parent of parent"));
       
  3411     pElement->SetParent(pParent);
       
  3412     pParent->SetParent(pPParent);
       
  3413     CSenElement* pEl1= pElement->Parent();
       
  3414     CSenElement* pEl2= pParent->Parent();
       
  3415     CSenElement* pEl3= pPParent->Parent();
       
  3416     const TDesC8& pLName1=pEl1->LocalName();
       
  3417     if(pLName1==_L8("Parent"))
       
  3418     	Flag=1;
       
  3419    	else
       
  3420    		Flag=0;
       
  3421         /*EUNIT_ASSERT( Flag );*/
       
  3422     if(!Flag)
       
  3423     return KErrArgument;   
       
  3424 
       
  3425     const TDesC8& pLName2=pEl2->LocalName();
       
  3426     if(pLName2==_L8("parent of parent"))
       
  3427     	PFlag=1;
       
  3428     else
       
  3429     	PFlag=0;
       
  3430 /*    EUNIT_ASSERT(PFlag);*/
       
  3431     if(!PFlag)
       
  3432     return KErrArgument;  
       
  3433     
       
  3434     if(pEl3==NULL)
       
  3435     	PPFlag=1;
       
  3436     else
       
  3437     	PPFlag=0;
       
  3438     /*EUNIT_ASSERT(PPFlag);*/
       
  3439     if(!PPFlag)
       
  3440     return KErrArgument;  
       
  3441     
       
  3442     delete pElement;
       
  3443     delete pParent;
       
  3444     delete pPParent;
       
  3445     Teardown();
       
  3446     return KErrNone;
       
  3447     }
       
  3448 
       
  3449 TInt CSenXmlBCTest::CSenXmlElement_SetParentL (TTestResult& aResult)
       
  3450     {
       
  3451     SetupL();
       
  3452     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3453     CleanupStack::PushL(pElement);
       
  3454     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent"));
       
  3455     CleanupStack::PushL(pParent);
       
  3456     pElement->SetNamespaceL(_L8("Nsuria"));
       
  3457     pParent->SetNamespaceL(_L8("nsurip"));
       
  3458     pElement->SetParent(pParent);
       
  3459     CSenElement* pPar=pElement->Parent();
       
  3460     const TDesC8& ParName=pPar->LocalName();
       
  3461 /*    EUNIT_ASSERT_EQUALS( ParName,_L8("Parent") ); */
       
  3462     TL(ParName == _L8("Parent"));
       
  3463     CleanupStack::PopAndDestroy(pParent);
       
  3464     CleanupStack::PopAndDestroy(pElement);
       
  3465     Teardown();
       
  3466     return KErrNone;
       
  3467     }
       
  3468 
       
  3469 TInt CSenXmlBCTest::CSenXmlElement_RootL (TTestResult& aResult)
       
  3470     {
       
  3471     SetupL();
       
  3472 	TBool Flag;
       
  3473     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  3474     const MSenElement& pElRoot=pElement->Root();
       
  3475     const TDesC8& pElLName=pElRoot.LocalName();
       
  3476     if(pElLName==_L8("Nokia"))
       
  3477     	Flag=1;
       
  3478     else
       
  3479     	Flag=0;
       
  3480     
       
  3481     CSenXmlElement* pParent1=CSenXmlElement::NewL(_L8("Parent1"));
       
  3482     pElement->SetParent(pParent1);
       
  3483     const MSenElement& pElRoot1=pElement->Root();
       
  3484     const TDesC8& pElLName1=pElRoot1.LocalName();
       
  3485     if(pElLName1==_L8("Parent1"))
       
  3486     	Flag=1;
       
  3487     else
       
  3488     	Flag=0;
       
  3489     
       
  3490     CSenXmlElement* pParent2=CSenXmlElement::NewL(_L8("Parent2"));
       
  3491     pParent1->SetParent(pParent2);
       
  3492     const MSenElement& pElRoot2=pElement->Root();
       
  3493     const TDesC8& pElLName2=pElRoot2.LocalName();
       
  3494 	const MSenElement& pParRoot=pParent1->Root();
       
  3495     const TDesC8& pParLName=pParRoot.LocalName();
       
  3496     if(pElLName2==_L8("Parent2") && pParLName==_L8("Parent2"))
       
  3497     	Flag=1;
       
  3498     else
       
  3499     	Flag=0;
       
  3500         
       
  3501         /*EUNIT_ASSERT( Flag );*/
       
  3502     if(!Flag)
       
  3503     return KErrArgument;   
       
  3504 
       
  3505     delete pElement;
       
  3506     delete pParent1;
       
  3507     delete pParent2;    
       
  3508     Teardown();
       
  3509     return KErrNone;
       
  3510     }
       
  3511 
       
  3512 TInt CSenXmlBCTest::CSenXmlElement_ElementL (TTestResult& aResult)
       
  3513     {
       
  3514     SetupL();
       
  3515     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent"));
       
  3516     CleanupStack::PushL(pParent);
       
  3517     CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Nokia1"));
       
  3518     CleanupStack::PushL(pElement1);
       
  3519     CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Nokia2"));
       
  3520     CleanupStack::PushL(pElement2);
       
  3521     CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Nokia3"));
       
  3522     CleanupStack::PushL(pElement3);
       
  3523     pParent->AddElementL(*pElement1);
       
  3524     pParent->AddElementL(*pElement2);
       
  3525     pParent->AddElementL(*pElement3);
       
  3526     CSenElement* element=pParent->Element(_L8("Nokia1"));
       
  3527 /*    EUNIT_ASSERT( element->LocalName()==_L8("Nokia1") );*/
       
  3528     if(!(element->LocalName()==_L8("Nokia1")))
       
  3529     return KErrArgument;  
       
  3530 
       
  3531     CleanupStack::Pop(3);
       
  3532     CleanupStack::PopAndDestroy(pParent);
       
  3533     Teardown();
       
  3534     return KErrNone;
       
  3535     }
       
  3536 
       
  3537 TInt CSenXmlBCTest::CSenXmlElement_CreateElementLL (TTestResult& aResult)
       
  3538     {
       
  3539     SetupL();
       
  3540     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("element"));
       
  3541     CleanupStack::PushL(pElement);
       
  3542     pElement->SetNamespaceL(_L8("N"),_L8("nsuri"));
       
  3543     CSenElement* pNewElement=pElement->CreateElementL(_L8("N"),_L8("Nokia"));
       
  3544     CleanupStack::PushL(pNewElement);
       
  3545     HBufC8* ElementBuf=pNewElement->AsXmlL();
       
  3546 /*    EUNIT_ASSERT_EQUALS(*ElementBuf,_L8("<N:Nokia xmlns:N=\"nsuri\"/>"));*/
       
  3547     TL(*ElementBuf == _L8("<N:Nokia xmlns:N=\"nsuri\"/>"));
       
  3548     CleanupStack::PopAndDestroy(pNewElement);
       
  3549     CleanupStack::PopAndDestroy(pElement);
       
  3550     delete ElementBuf;
       
  3551     Teardown();
       
  3552     return KErrNone;
       
  3553     }
       
  3554 
       
  3555 TInt CSenXmlBCTest::CSenXmlElement_InsertElementLL (TTestResult& aResult)
       
  3556     {
       
  3557     SetupL();
       
  3558     
       
  3559      TBool Flag;
       
  3560      CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("Parent"));
       
  3561      CleanupStack::PushL(pParent);
       
  3562      CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Nokia1"));
       
  3563      CleanupStack::PushL(pElement1);
       
  3564      CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Nokia2"));
       
  3565      CleanupStack::PushL(pElement2);
       
  3566      CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Nokia3"));
       
  3567      CleanupStack::PushL(pElement3);
       
  3568      CSenXmlElement* pElement5=CSenXmlElement::NewL(_L8("Nokia5"));
       
  3569      CleanupStack::PushL(pElement5);
       
  3570      pParent->AddElementL(*pElement1);
       
  3571      pParent->AddElementL(*pElement2);
       
  3572      pParent->AddElementL(*pElement3);
       
  3573      pParent->AddElementL(*pElement5);
       
  3574      CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Nokia4"));
       
  3575      CleanupStack::PushL(pElement4);
       
  3576      pParent->InsertElementL(*pElement4,*pElement5);
       
  3577      RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  3578      const TDesC8& localName=elementList[3]->LocalName();
       
  3579      if(localName==_L8("Nokia4"))
       
  3580      	Flag=1;
       
  3581      else
       
  3582      	Flag=0;
       
  3583          /*EUNIT_ASSERT( Flag );*/
       
  3584     if(!Flag)
       
  3585     return KErrArgument;   
       
  3586 
       
  3587      CleanupStack::Pop(pElement4);
       
  3588 	 CleanupStack::Pop(pElement5);
       
  3589      CleanupStack::Pop(pElement3);
       
  3590      CleanupStack::Pop(pElement2);
       
  3591      CleanupStack::Pop(pElement1);
       
  3592      CleanupStack::PopAndDestroy(pParent); 
       
  3593     Teardown();
       
  3594     return KErrNone;
       
  3595     }
       
  3596 
       
  3597 TInt CSenXmlBCTest::CSenXmlElement_AddElementLL (TTestResult& aResult)
       
  3598     {
       
  3599     SetupL();
       
  3600     TBool Flag;
       
  3601     CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3602     CleanupStack::PushL(pParent);
       
  3603     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nokia"));
       
  3604     CleanupStack::PushL(pElement);
       
  3605     CSenElement& newElement=pParent->AddElementL(*pElement);
       
  3606     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  3607     const TDesC8& localName=elementList[0]->LocalName();
       
  3608     const TDesC8& localName1=newElement.LocalName();    
       
  3609     if(localName==_L8("nokia") && elementList.Count()==1 )//&& newElement!=NULL)
       
  3610     	Flag=1;
       
  3611     else
       
  3612     	Flag=0;
       
  3613         /*EUNIT_ASSERT( Flag );*/
       
  3614     if(!Flag)
       
  3615     return KErrArgument;   
       
  3616 
       
  3617     CleanupStack::Pop(pElement);
       
  3618     CleanupStack::PopAndDestroy(pParent);
       
  3619     Teardown();
       
  3620     return KErrNone;
       
  3621     }
       
  3622 
       
  3623 TInt CSenXmlBCTest::CSenXmlElement_AddElementL_1L (TTestResult& aResult)
       
  3624     {
       
  3625     SetupL();
       
  3626     TBool Flag;
       
  3627     CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3628     CleanupStack::PushL(pParent);
       
  3629     CSenElement& newElement=pParent->AddElementL(_L8("element"));
       
  3630     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  3631     const TDesC8& localName=elementList[0]->LocalName(); 
       
  3632     if(localName==_L8("element") && elementList.Count()==1 )
       
  3633     	Flag=1;
       
  3634     else
       
  3635     	Flag=0;
       
  3636         /*EUNIT_ASSERT( Flag );*/
       
  3637     if(!Flag)
       
  3638     return KErrArgument;   
       
  3639 
       
  3640     CleanupStack::PopAndDestroy(pParent);
       
  3641     Teardown();
       
  3642     return KErrNone;
       
  3643     }
       
  3644 
       
  3645 TInt CSenXmlBCTest::CSenXmlElement_AddElementL_2L (TTestResult& aResult)
       
  3646     {
       
  3647     SetupL();
       
  3648     TBool Flag;
       
  3649     CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3650     CleanupStack::PushL(pParent);
       
  3651     CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element"));
       
  3652     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  3653     const TDesC8& localName=elementList[0]->LocalName(); 
       
  3654     const TDesC8& nsUri=elementList[0]->NamespaceURI(); 
       
  3655     if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria"))
       
  3656     	Flag=1;
       
  3657     else
       
  3658     	Flag=0;
       
  3659         /*EUNIT_ASSERT( Flag );*/
       
  3660     if(!Flag)
       
  3661     return KErrArgument;   
       
  3662 
       
  3663     CleanupStack::PopAndDestroy(pParent);
       
  3664     Teardown();
       
  3665     return KErrNone;
       
  3666     }
       
  3667 
       
  3668 TInt CSenXmlBCTest::CSenXmlElement_AddElementL_3L (TTestResult& aResult)
       
  3669     {
       
  3670     SetupL();
       
  3671 	TBool Flag;
       
  3672     CSenXmlElement *pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3673     CleanupStack::PushL(pParent);
       
  3674     CSenElement& newElement=pParent->AddElementL(_L8("nsuria"),_L8("element"),_L8("e:element"));
       
  3675     RPointerArray<CSenElement>& elementList=pParent->ElementsL();
       
  3676     const TDesC8& localName=elementList[0]->LocalName(); 
       
  3677     const TDesC8& nsUri=elementList[0]->NamespaceURI(); 
       
  3678     if(localName==_L8("element") && elementList.Count()==1 && nsUri==_L8("nsuria"))
       
  3679     	Flag=1;
       
  3680     else
       
  3681     	Flag=0;
       
  3682         /*EUNIT_ASSERT( Flag );*/
       
  3683     if(!Flag)
       
  3684     return KErrArgument;   
       
  3685 
       
  3686     CleanupStack::PopAndDestroy(pParent);    
       
  3687     Teardown();
       
  3688     return KErrNone;
       
  3689     }
       
  3690 
       
  3691 TInt CSenXmlBCTest::CSenXmlElement_RemoveElementL (TTestResult& aResult)
       
  3692     {
       
  3693     SetupL();
       
  3694     TBool TFlag;
       
  3695     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3696     CleanupStack::PushL(pParent);
       
  3697     CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Element1"));
       
  3698     CleanupStack::PushL(pElement1);
       
  3699     CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Element2"));
       
  3700     CleanupStack::PushL(pElement2);
       
  3701     CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Element3"));
       
  3702     CleanupStack::PushL(pElement3);
       
  3703     CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Element4"));
       
  3704     CleanupStack::PushL(pElement4);
       
  3705     pParent->AddElementL(*pElement1);
       
  3706     pParent->AddElementL(*pElement2);
       
  3707     pParent->AddElementL(*pElement3);
       
  3708     pParent->AddElementL(*pElement4);
       
  3709     //true case
       
  3710     CSenElement* pRmdElement=pParent->RemoveElement(*pElement3);
       
  3711     const TDesC8& localName=pRmdElement->LocalName();
       
  3712     /*CSenElement* pParElement=pElement3->Parent();//intentional
       
  3713     const TDesC8& localnmae1=pParElement->LocalName();*/
       
  3714     RPointerArray<CSenElement>& elList=pParent->ElementsL();
       
  3715     if(localName==_L8("Element3") && elList.Count()==3 )
       
  3716     	TFlag=1;
       
  3717     else
       
  3718     	TFlag=0;
       
  3719 /*    EUNIT_ASSERT( TFlag );*/
       
  3720     if(!TFlag)
       
  3721     return KErrArgument;  
       
  3722     
       
  3723     CleanupStack::Pop(4);
       
  3724     CleanupStack::PopAndDestroy(pParent);
       
  3725     delete pRmdElement;
       
  3726     //delete pRmdElement1;
       
  3727     Teardown();
       
  3728     return KErrNone;
       
  3729     }
       
  3730 
       
  3731 TInt CSenXmlBCTest::CSenXmlElement_RemoveElement_1L (TTestResult& aResult)
       
  3732     {
       
  3733     SetupL();
       
  3734     TBool TFlag,FFlag;
       
  3735     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3736     CleanupStack::PushL(pParent);
       
  3737     pParent->AddElementL(_L8("element1"));
       
  3738     pParent->AddElementL(_L8("element2"));
       
  3739     pParent->AddElementL(_L8("element3"));
       
  3740     pParent->AddElementL(_L8("element4"));
       
  3741     //True case
       
  3742     CSenElement* pRmdElement=pParent->RemoveElement(_L8("element1"));
       
  3743     RPointerArray<CSenElement>& elList=pParent->ElementsL();   
       
  3744     if(pRmdElement->LocalName()==_L8("element1") && elList.Count()==3)
       
  3745     	TFlag=1;
       
  3746     else
       
  3747     	TFlag=0;
       
  3748 /*    EUNIT_ASSERT( TFlag );*/
       
  3749     if(!TFlag)
       
  3750     return KErrArgument;  
       
  3751 
       
  3752     //False case
       
  3753     CSenElement* pRmdElement1=pParent->RemoveElement(_L8("none"));
       
  3754     elList=pParent->ElementsL();
       
  3755     if(pRmdElement1==NULL && elList.Count()==3)
       
  3756     	FFlag=1;
       
  3757     else
       
  3758     	FFlag=0;
       
  3759 /*    EUNIT_ASSERT(FFlag);*/
       
  3760     if(!FFlag)
       
  3761     return KErrArgument;  
       
  3762 
       
  3763 	CleanupStack::PopAndDestroy(pParent);
       
  3764 	delete pRmdElement;
       
  3765 	//delete pRmdElement1;
       
  3766     Teardown();
       
  3767     return KErrNone;
       
  3768     }
       
  3769 
       
  3770 TInt CSenXmlBCTest::CSenXmlElement_RemoveElement_2L (TTestResult& aResult)
       
  3771     {
       
  3772     SetupL();
       
  3773     TBool TFlag,FFlag;
       
  3774     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3775     CleanupStack::PushL(pParent);
       
  3776     pParent->AddElementL(_L8("nsuri1"),_L8("element1"));
       
  3777     pParent->AddElementL(_L8("nsuri2"),_L8("element2"));
       
  3778     pParent->AddElementL(_L8("nsuri2a"),_L8("element2"));
       
  3779     pParent->AddElementL(_L8("nsuri4"),_L8("element4"));
       
  3780     //True case
       
  3781     CSenElement* pRmdElement=pParent->RemoveElement(_L8("nsuri2a"),_L8("element2"));
       
  3782     RPointerArray<CSenElement>& elList=pParent->ElementsL();   
       
  3783     const TDesC8& localName=pRmdElement->LocalName();
       
  3784     const TDesC8& nsURI=pRmdElement->NamespaceURI();
       
  3785     if(localName==_L8("element2") && nsURI==_L8("nsuri2a") && elList.Count()==3)
       
  3786     	TFlag=1;
       
  3787     else
       
  3788     	TFlag=0;
       
  3789 /*    EUNIT_ASSERT( TFlag );*/
       
  3790     if(!TFlag)
       
  3791     return KErrArgument;  
       
  3792 
       
  3793     //False case
       
  3794     CSenElement* pRmdElement1=pParent->RemoveElement(_L8("element1"),_L8("nothing"));
       
  3795     elList=pParent->ElementsL();
       
  3796     if(pRmdElement1==NULL && elList.Count()==3)
       
  3797     	FFlag=1;
       
  3798     else
       
  3799     	FFlag=0;
       
  3800 /*    EUNIT_ASSERT(FFlag);*/
       
  3801     if(!FFlag)
       
  3802     return KErrArgument;  
       
  3803 
       
  3804     CleanupStack::PopAndDestroy(pParent);
       
  3805 	delete pRmdElement;
       
  3806 	delete pRmdElement1;
       
  3807     
       
  3808     Teardown();
       
  3809     return KErrNone;
       
  3810     }
       
  3811 
       
  3812 TInt CSenXmlBCTest::CSenXmlElement_ReplaceElementLL (TTestResult& aResult)
       
  3813     {
       
  3814     SetupL();
       
  3815     TBool FFlag,TFlag;
       
  3816     _LIT8(KNewElement,"<a:Element1 xmlns:a=\"nsuria\"><subelement1/>New content</a:Element1>");
       
  3817     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3818     CleanupStack::PushL(pParent);
       
  3819     CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Element1"));
       
  3820     CleanupStack::PushL(pElement1);
       
  3821     pElement1->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  3822     pElement1->SetContentL(_L8("old content"));
       
  3823     CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Element2"));
       
  3824     CleanupStack::PushL(pElement2);
       
  3825     CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Element3"));
       
  3826     CleanupStack::PushL(pElement3);
       
  3827     CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Element4"));
       
  3828     CleanupStack::PushL(pElement4);
       
  3829     pParent->AddElementL(*pElement1);
       
  3830     pParent->AddElementL(*pElement2);
       
  3831     pParent->AddElementL(*pElement3);
       
  3832     pParent->AddElementL(*pElement4); 
       
  3833     //true case
       
  3834     CSenXmlElement* pNewElement=CSenXmlElement::NewL(_L8("Element1"));
       
  3835     pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  3836     CleanupStack::PushL(pNewElement);
       
  3837     pNewElement->AddElementL(_L8("subelement1"));
       
  3838     pNewElement->SetContentL(_L8("New content"));
       
  3839     CSenElement* pReplacedElement=pParent->ReplaceElementL(*pNewElement);
       
  3840     RPointerArray<CSenElement>& elList=pParent->ElementsL();
       
  3841     HBufC8* pRepBuf=elList[(elList.Count()-1)]->AsXmlL();
       
  3842     if(pReplacedElement!=NULL && elList.Count()==4 && 
       
  3843     	elList[(elList.Count()-1)]->LocalName()==_L8("Element1") && 
       
  3844     	*pRepBuf==KNewElement && elList[(elList.Count()-1)]->Content()==_L8("New content") )
       
  3845     	TFlag=1;
       
  3846     else
       
  3847     	TFlag=0;
       
  3848 /*    EUNIT_ASSERT( TFlag );*/
       
  3849     if(!TFlag)
       
  3850     return KErrArgument;  
       
  3851 
       
  3852     //False case
       
  3853     CSenXmlElement* pNewElement1=CSenXmlElement::NewL(_L8("New Element1"));
       
  3854     pNewElement->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  3855     CleanupStack::PushL(pNewElement1);
       
  3856     CSenElement* pReplacedElement1=pParent->ReplaceElementL(*pNewElement1);
       
  3857     RPointerArray<CSenElement>& elList1=pParent->ElementsL();
       
  3858     if(pReplacedElement1==NULL && elList1.Count()==5)
       
  3859     	FFlag=1;
       
  3860     else
       
  3861     	FFlag=0;
       
  3862 /*    EUNIT_ASSERT(FFlag);*/
       
  3863     if(!FFlag)
       
  3864     return KErrArgument;  
       
  3865 
       
  3866     CleanupStack::Pop(pNewElement1);
       
  3867     CleanupStack::Pop(pNewElement);
       
  3868     CleanupStack::Pop(4);
       
  3869     CleanupStack::PopAndDestroy(pParent);
       
  3870     delete pReplacedElement;
       
  3871     delete pRepBuf;
       
  3872     delete pReplacedElement1;
       
  3873     Teardown();
       
  3874     return KErrNone;
       
  3875     }
       
  3876 
       
  3877 TInt CSenXmlBCTest::CSenXmlElement_AsXmlLL (TTestResult& aResult)
       
  3878     {
       
  3879     SetupL();
       
  3880     TBool Flag;
       
  3881     _LIT8(KString,"<parent><element1/><element2/><element3/>parent content</parent>");
       
  3882     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3883     CleanupStack::PushL(pParent) ;
       
  3884     pParent->AddElementL(_L8("element1"));
       
  3885     pParent->AddElementL(_L8("element2"));
       
  3886     pParent->SetContentL(_L8("parent content"));
       
  3887     pParent->AddElementL(_L8("element3"));
       
  3888     HBufC8* parBuf=pParent->AsXmlL();
       
  3889     if(*parBuf==KString)
       
  3890      	Flag=1;
       
  3891     else
       
  3892     	Flag=0;
       
  3893         /*EUNIT_ASSERT( Flag );*/
       
  3894     if(!Flag)
       
  3895     return KErrArgument;   
       
  3896 
       
  3897     delete parBuf;
       
  3898     CleanupStack::PopAndDestroy(pParent);
       
  3899     Teardown();
       
  3900     return KErrNone;
       
  3901     }
       
  3902 
       
  3903 TInt CSenXmlBCTest::CSenXmlElement_AsXmlUnicodeLL (TTestResult& aResult)
       
  3904     {
       
  3905     SetupL();
       
  3906     TBool Flag;
       
  3907     _LIT(KString,"<parent><element1/><element2/><element3/>parent content</parent>");
       
  3908     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3909     CleanupStack::PushL(pParent) ;
       
  3910     pParent->AddElementL(_L8("element1"));
       
  3911     pParent->AddElementL(_L8("element2"));
       
  3912     pParent->SetContentL(_L8("parent content"));
       
  3913     pParent->AddElementL(_L8("element3"));
       
  3914     HBufC* parBuf=pParent->AsXmlUnicodeL();
       
  3915     if(*parBuf==KString)
       
  3916      	Flag=1;
       
  3917     else
       
  3918     	Flag=0;
       
  3919         /*EUNIT_ASSERT( Flag );*/
       
  3920     if(!Flag)
       
  3921     return KErrArgument;   
       
  3922 
       
  3923     delete parBuf;
       
  3924     CleanupStack::PopAndDestroy(pParent);
       
  3925     Teardown();
       
  3926     return KErrNone;
       
  3927     }
       
  3928 
       
  3929 TInt CSenXmlBCTest::CSenXmlElement_CopyFromLL (TTestResult& aResult)
       
  3930     {
       
  3931     SetupL();
       
  3932     TBool Flag;
       
  3933     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("xml element"));
       
  3934     CleanupStack::PushL(pElement);
       
  3935     pElement->AddElementL(_L8("child1"));
       
  3936     pElement->AddElementL(_L8("child2"));
       
  3937     pElement->SetContentL(_L8("element content"));
       
  3938     pElement->AddNamespaceL(_L8("a"),_L8("nsuri"));
       
  3939     CSenXmlElement* pCopied=CSenXmlElement::NewL(_L8("copied element"));
       
  3940     CleanupStack::PushL(pCopied);
       
  3941     pCopied->SetContentL(_L8("copy content"));
       
  3942     pCopied->AddElementL(_L8("child1"));
       
  3943     pCopied->AddNamespaceL(_L8("a"),_L8("nsuri"));
       
  3944     pCopied->CopyFromL(*pElement);
       
  3945     const TDesC8& content=pCopied->Content();
       
  3946     const RPointerArray<CSenElement>& copElList=pCopied->ElementsL();
       
  3947     const RPointerArray<CSenNamespace>& copNSList=pCopied->NamespacesL();
       
  3948     if(copElList.Count()==3 && copNSList.Count()==2)
       
  3949     	Flag=1;
       
  3950     else
       
  3951     	Flag=0;
       
  3952         /*EUNIT_ASSERT( Flag );*/
       
  3953     if(!Flag)
       
  3954     return KErrArgument;   
       
  3955 
       
  3956     CleanupStack::PopAndDestroy(pCopied);
       
  3957     CleanupStack::PopAndDestroy(pElement);
       
  3958     Teardown();
       
  3959     return KErrNone;
       
  3960     }
       
  3961 
       
  3962 TInt CSenXmlBCTest::CSenXmlElement_DetachLL (TTestResult& aResult)
       
  3963     {
       
  3964     SetupL();
       
  3965     CSenXmlElement* pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3966     CleanupStack::PushL(pParent);
       
  3967     CSenXmlElement* pElement1=CSenXmlElement::NewL(_L8("Element1"));
       
  3968     CleanupStack::PushL(pElement1);
       
  3969     pElement1->SetNamespaceL(_L8("a"),_L8("nsuria"));
       
  3970     pElement1->SetContentL(_L8("old content"));
       
  3971     CSenXmlElement* pElement2=CSenXmlElement::NewL(_L8("Element2"));
       
  3972     CleanupStack::PushL(pElement2);
       
  3973     CSenXmlElement* pElement3=CSenXmlElement::NewL(_L8("Element3"));
       
  3974     CleanupStack::PushL(pElement3);
       
  3975     CSenXmlElement* pElement4=CSenXmlElement::NewL(_L8("Element4"));
       
  3976     CleanupStack::PushL(pElement4);
       
  3977     pParent->AddElementL(*pElement1);
       
  3978     pParent->AddElementL(*pElement2);
       
  3979     pParent->AddElementL(*pElement3);
       
  3980     pParent->AddElementL(*pElement4); 
       
  3981     CSenElement* dElement=pElement1->DetachL();
       
  3982     const RPointerArray<CSenElement>& elList=pParent->ElementsL();
       
  3983 /*    EUNIT_ASSERT( elList.Count()==3 );*/
       
  3984     if(!( elList.Count()==3 ))
       
  3985     return KErrArgument;  
       
  3986 
       
  3987     CleanupStack::Pop(4);
       
  3988     CleanupStack::PopAndDestroy(pParent);
       
  3989     delete dElement;
       
  3990     Teardown();
       
  3991     return KErrNone;
       
  3992     }
       
  3993 
       
  3994 TInt CSenXmlBCTest::CSenXmlElement_ChildL (TTestResult& aResult)
       
  3995     {
       
  3996     SetupL();
       
  3997     TBool FFlag,TFlag;
       
  3998     CSenXmlElement*pParent=CSenXmlElement::NewL(_L8("parent"));
       
  3999     CleanupStack::PushL(pParent);
       
  4000     pParent->AddElementL(_L8("element1"));
       
  4001     pParent->AddElementL(_L8("element2"));
       
  4002     pParent->AddElementL(_L8("element3"));
       
  4003     CSenElement* pElement=pParent->Child(0);
       
  4004     if(pElement->LocalName()==_L8("element1"))
       
  4005     	TFlag=1;
       
  4006     else
       
  4007     	TFlag=0;
       
  4008 /*    EUNIT_ASSERT( TFlag );*/
       
  4009     if(!TFlag)
       
  4010     return KErrArgument;  
       
  4011 
       
  4012     CSenElement* pElement1=pParent->Child(4);
       
  4013     if(pElement1==NULL)
       
  4014     	FFlag=1;
       
  4015     else
       
  4016     	FFlag=0;
       
  4017 /*    EUNIT_ASSERT( FFlag );*/
       
  4018     if(!FFlag)
       
  4019     return KErrArgument;  
       
  4020     
       
  4021     
       
  4022     CleanupStack::PopAndDestroy(pParent);
       
  4023     Teardown();
       
  4024     return KErrNone;
       
  4025     }
       
  4026 
       
  4027 TInt CSenXmlBCTest::CSenXmlElement_SetL (TTestResult& aResult)
       
  4028     {
       
  4029     SetupL();
       
  4030     TBool Flag;
       
  4031     CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("nokia"));
       
  4032     CleanupStack::PushL(pElement);
       
  4033     pElement->Set(_L8("nsuri"),_L8("element"),_L8("e:e:lement"));
       
  4034     if(pElement->LocalName()==_L8("element") && pElement->NamespaceURI()==_L8("nsuri") 
       
  4035     		&& pElement->NsPrefix()==_L8("e"))
       
  4036     		Flag=1;
       
  4037     else
       
  4038     		Flag=0;
       
  4039     
       
  4040         /*EUNIT_ASSERT( Flag );*/
       
  4041     if(!Flag)
       
  4042     return KErrArgument;   
       
  4043 
       
  4044     CleanupStack::PopAndDestroy(pElement);
       
  4045     Teardown();
       
  4046     return KErrNone;
       
  4047     }
       
  4048 
       
  4049 TInt CSenXmlBCTest::CSenXmlElement_AddAttributesLL (TTestResult& aResult)
       
  4050     {
       
  4051     SetupL();
       
  4052     RStringPool stringPool;
       
  4053     stringPool.OpenL();
       
  4054     CleanupClosePushL(stringPool);
       
  4055     
       
  4056     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  4057     CleanupClosePushL(nsUriRString);
       
  4058     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  4059     CleanupClosePushL(nsPrefixRString);
       
  4060     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  4061     CleanupClosePushL(localNameRString);
       
  4062     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  4063     CleanupClosePushL(valueRString);
       
  4064     
       
  4065     RAttribute attribute;
       
  4066     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  4067                    valueRString);
       
  4068     CleanupStack::Pop(4); 
       
  4069     CleanupClosePushL(attribute);
       
  4070 
       
  4071     RAttributeArray attrArray;
       
  4072     attrArray.AppendL(attribute);
       
  4073     CleanupClosePushL(attrArray); 
       
  4074       
       
  4075     CSenXmlElement *pElement = CSenXmlElement::NewL(_L8("Nokia"));
       
  4076     CleanupStack::PushL(pElement);
       
  4077     pElement->AddAttributesL(attrArray);
       
  4078     HBufC8* pElementBuf = pElement->AsXmlL();
       
  4079 /*    EUNIT_ASSERT( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" ));*/
       
  4080     if(!( *pElementBuf == _L8("<Nokia pr:LocalName=\"Value\"/>" )))
       
  4081     return KErrArgument;  
       
  4082 
       
  4083 	CleanupStack::PopAndDestroy(pElement);
       
  4084 	CleanupStack::PopAndDestroy(&attrArray);
       
  4085     CleanupStack::PopAndDestroy(&attribute);
       
  4086     CleanupStack::PopAndDestroy(&stringPool);
       
  4087 	delete pElementBuf;
       
  4088     Teardown();
       
  4089     return KErrNone;
       
  4090     }
       
  4091 /*    
       
  4092 TInt CSenXmlBCTest::CSenXmlElement_RemoveAttributeLL (TTestResult& aResult)
       
  4093     {
       
  4094     SetupL();
       
  4095     RStringPool stringPool;
       
  4096     stringPool.OpenL();
       
  4097     CleanupClosePushL(stringPool);
       
  4098     
       
  4099     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  4100     CleanupClosePushL(nsUriRString);
       
  4101     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  4102     CleanupClosePushL(nsPrefixRString);
       
  4103     RString localNameRString    = stringPool.OpenStringL(_L8("LocalName"));
       
  4104     CleanupClosePushL(localNameRString);
       
  4105     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  4106     CleanupClosePushL(valueRString);
       
  4107     
       
  4108     RAttribute attribute;
       
  4109     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  4110                    valueRString);
       
  4111     CleanupStack::Pop(4); 
       
  4112     CleanupClosePushL(attribute);
       
  4113 
       
  4114     RAttributeArray attrArray;
       
  4115     attrArray.AppendL(attribute);
       
  4116     CleanupClosePushL(attrArray); 
       
  4117       
       
  4118     CSenXmlElement *pElement = CSenXmlElement::NewL(_L8("Nokia"));
       
  4119     CleanupStack::PushL(pElement);
       
  4120     pElement->AddAttributesL(attrArray);
       
  4121     CSenBaseAttribute* RmdElement=pElement->RemoveAttributeL(_L8("pr:LocalName"));
       
  4122     HBufC8* pElementBuf = pElement->AsXmlL();
       
  4123     RPointerArray<CSenBaseAttribute>& AttrList=pElement->AttributesL();
       
  4124     EUNIT_ASSERT( *pElementBuf == _L8("<Nokia/>" ));
       
  4125     EUNIT_ASSERT_EQUALS(AttrList.Count(),0);
       
  4126     TL(AttrList.Count() == 0);
       
  4127    	CleanupStack::PopAndDestroy(pElement);
       
  4128 	CleanupStack::PopAndDestroy(&attrArray);
       
  4129     CleanupStack::PopAndDestroy(&attribute);
       
  4130     CleanupStack::PopAndDestroy(&stringPool);
       
  4131 	delete pElementBuf;
       
  4132 	delete RmdElement;
       
  4133     Teardown();
       
  4134     return KErrNone;
       
  4135     }
       
  4136 */
       
  4137 TInt CSenXmlBCTest::CSenXmlElement_AsElementL(TTestResult& aResult)
       
  4138 	{
       
  4139     SetupL();
       
  4140 	CSenXmlElement* pElement=CSenXmlElement::NewL(_L8("Nokia"));
       
  4141 	CleanupStack::PushL(pElement);
       
  4142 	pElement->AddElementL(_L8("webservices"));
       
  4143 	MSenElement* pAsElement=pElement->AsElement();
       
  4144 	HBufC8* pElementBuf=pElement->AsXmlL();
       
  4145 /*	EUNIT_ASSERT_EQUALS(*pElementBuf,_L8("<Nokia><webservices/></Nokia>"));*/
       
  4146 	TL(*pElementBuf == _L8("<Nokia><webservices/></Nokia>"));
       
  4147 	CleanupStack::PopAndDestroy(pElement);
       
  4148 	delete pElementBuf;
       
  4149 	Teardown();
       
  4150     return KErrNone;
       
  4151     }
       
  4152 	
       
  4153 TInt CSenXmlBCTest::CSenBaseFragment_NewL_L (TTestResult& aResult)
       
  4154     {
       
  4155     SetupL();
       
  4156     TBool Flag;
       
  4157     CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia"));
       
  4158     CleanupStack::PushL(ele);
       
  4159     CSenElement* parent = ele->Parent();
       
  4160     CSenBaseFragment* pElement=CSenBaseFragment::NewL(*ele);
       
  4161     CleanupStack::PushL(pElement);
       
  4162     if(pElement!=NULL)
       
  4163     	Flag=1;
       
  4164     else
       
  4165     	Flag=0;
       
  4166         /*EUNIT_ASSERT( Flag );*/
       
  4167     if(!Flag)
       
  4168     return KErrArgument;   
       
  4169 
       
  4170     CleanupStack::PopAndDestroy(pElement);
       
  4171     CleanupStack::PopAndDestroy(ele);
       
  4172     Teardown();
       
  4173     return KErrNone;
       
  4174     }
       
  4175 	
       
  4176 TInt CSenXmlBCTest::CSenBaseFragment_NewL_1L (TTestResult& aResult)
       
  4177     {
       
  4178     SetupL();
       
  4179     TBool Flag;
       
  4180     CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("Nokia"));
       
  4181     CleanupStack::PushL(pElement);
       
  4182     if(pElement!=NULL)
       
  4183     	Flag=1;
       
  4184     else
       
  4185     	Flag=0;
       
  4186         /*EUNIT_ASSERT( Flag );*/
       
  4187     if(!Flag)
       
  4188     return KErrArgument;   
       
  4189 
       
  4190     CleanupStack::PopAndDestroy(pElement);
       
  4191     Teardown();
       
  4192     return KErrNone;
       
  4193     }
       
  4194 
       
  4195 TInt CSenXmlBCTest::CSenBaseFragment_NewL_2L (TTestResult& aResult)
       
  4196     {
       
  4197     SetupL();
       
  4198     TBool Flag;
       
  4199     CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"));
       
  4200     CleanupStack::PushL(pElement);
       
  4201     if(pElement!=NULL)
       
  4202     	Flag=1;
       
  4203     else
       
  4204     	Flag=0;
       
  4205         /*EUNIT_ASSERT( Flag );*/
       
  4206     if(!Flag)
       
  4207     return KErrArgument;   
       
  4208 
       
  4209     CleanupStack::PopAndDestroy(pElement);
       
  4210     Teardown();
       
  4211     return KErrNone;
       
  4212     }
       
  4213 
       
  4214 TInt CSenXmlBCTest::CSenBaseFragment_NewL_3L (TTestResult& aResult)
       
  4215     {
       
  4216     SetupL();
       
  4217     TBool Flag;
       
  4218     CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"));
       
  4219     CleanupStack::PushL(pElement);
       
  4220     if(pElement!=NULL)
       
  4221     	Flag=1;
       
  4222     else
       
  4223     	Flag=0;
       
  4224         /*EUNIT_ASSERT( Flag );*/
       
  4225     if(!Flag)
       
  4226     return KErrArgument;   
       
  4227 
       
  4228     CleanupStack::PopAndDestroy(pElement);
       
  4229     Teardown();
       
  4230     return KErrNone;
       
  4231     }
       
  4232     
       
  4233 TInt CSenXmlBCTest::CSenBaseFragment_NewL_4L (TTestResult& aResult)
       
  4234     {
       
  4235     SetupL();
       
  4236     TBool Flag;
       
  4237     RAttributeArray aAttrs;
       
  4238     CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs);
       
  4239     CleanupStack::PushL(pElement);
       
  4240     if(pElement!=NULL)
       
  4241     	Flag=1;
       
  4242     else
       
  4243     	Flag=0;
       
  4244         /*EUNIT_ASSERT( Flag );*/
       
  4245     if(!Flag)
       
  4246     return KErrArgument;   
       
  4247 
       
  4248     CleanupStack::PopAndDestroy(pElement);
       
  4249     Teardown();
       
  4250     return KErrNone;
       
  4251     }
       
  4252     
       
  4253 TInt CSenXmlBCTest::CSenBaseFragment_NewL_5L (TTestResult& aResult)
       
  4254     {
       
  4255     SetupL();
       
  4256     TBool Flag;
       
  4257     RAttributeArray aAttrs;
       
  4258     CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia"));
       
  4259     CleanupStack::PushL(ele);
       
  4260     CSenElement* parent = ele->Parent();
       
  4261     CSenBaseFragment* pElement=CSenBaseFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs, *parent);
       
  4262     CleanupStack::PushL(pElement);
       
  4263     if(pElement!=NULL)
       
  4264     	Flag=1;
       
  4265     else
       
  4266     	Flag=0;
       
  4267         /*EUNIT_ASSERT( Flag );*/
       
  4268     if(!Flag)
       
  4269     return KErrArgument;   
       
  4270 
       
  4271     CleanupStack::PopAndDestroy(pElement);
       
  4272     CleanupStack::PopAndDestroy(ele);
       
  4273     Teardown();
       
  4274     return KErrNone;
       
  4275     }
       
  4276 	
       
  4277 TInt CSenXmlBCTest::CSenBaseFragment_AsXmlUnicodeLL(TTestResult& aResult)
       
  4278 	{
       
  4279     SetupL();
       
  4280 	CSenBaseFragment* pFragment=CSenBaseFragment::NewL(_L8("Fragment"));
       
  4281 	CleanupStack::PushL(pFragment);
       
  4282 	HBufC* pFragBuf=pFragment->AsXmlUnicodeL();
       
  4283 /*	EUNIT_ASSERT_EQUALS(*pFragBuf,_L("<Fragment/>"));*/
       
  4284 	TL(*pFragBuf == _L("<Fragment/>"));
       
  4285 	CleanupStack::PopAndDestroy(pFragment);
       
  4286 	delete pFragBuf;
       
  4287 	Teardown();
       
  4288     return KErrNone;
       
  4289     }
       
  4290 	
       
  4291 TInt CSenXmlBCTest::CSenBaseFragment_WriteAsXMLToLL(TTestResult& aResult)
       
  4292     {
       
  4293     SetupL();
       
  4294     // Test serialization of Dom tree which has two child elements
       
  4295     CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4296     CleanupStack::PushL(pFragment);
       
  4297     CSenElement& element = pFragment->AsElement();
       
  4298     CSenElement& element2 = element.AddElementL(_L8("Child"));
       
  4299     CBufFlat* pBuf = CBufFlat::NewL(200);
       
  4300     CleanupStack::PushL(pBuf);
       
  4301     RBufWriteStream bufWs(*pBuf);
       
  4302     CleanupClosePushL(bufWs);
       
  4303     pFragment->WriteAsXMLToL(bufWs);
       
  4304 /*    EUNIT_ASSERT( pBuf->Ptr(0) == _L8("<Test><Child/></Test>"));*/
       
  4305     if(!( pBuf->Ptr(0) == _L8("<Test><Child/></Test>")))
       
  4306     return KErrArgument;  
       
  4307 
       
  4308     CleanupStack::PopAndDestroy(&bufWs);
       
  4309     CleanupStack::PopAndDestroy(pBuf);
       
  4310     CleanupStack::PopAndDestroy(pFragment);
       
  4311     Teardown();
       
  4312     return KErrNone;
       
  4313     }
       
  4314     
       
  4315 TInt CSenXmlBCTest::CSenBaseFragment_ContentL( TTestResult& aResult )
       
  4316 	{
       
  4317 	TBool Flag;
       
  4318 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4319 	CleanupStack::PushL(pFragment);
       
  4320 	CSenElement& element = pFragment->AsElement();
       
  4321     element.AddElementL(_L8("Child"));
       
  4322     element.SetContentL(_L8("Test Content"));
       
  4323     TPtrC8 frag_Content = pFragment->Content();
       
  4324     if(frag_Content == _L8("Test Content"))
       
  4325     	Flag =1;
       
  4326     else
       
  4327     	Flag =0;
       
  4328     CleanupStack::PopAndDestroy(pFragment);
       
  4329     if (Flag) return KErrNone;
       
  4330     else return KErrArgument;
       
  4331 	}
       
  4332 TInt CSenXmlBCTest::CSenBaseFragment_NamespaceL( TTestResult& aResult )
       
  4333 	{
       
  4334 	TBool Flag;
       
  4335 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuria"),_L8("Test"),_L8("a:Test"));
       
  4336 	CleanupStack::PushL(pFragment);
       
  4337 	CSenElement& element = pFragment->AsElement();
       
  4338     element.AddElementL(_L8("Child"));
       
  4339     element.SetContentL(_L8("Test Content"));
       
  4340     TPtrC8 frag_NameSpace = pFragment->NsUri();
       
  4341     TPtrC8 frag_prefix = pFragment->NsPrefix();
       
  4342     if(frag_NameSpace == _L8("nsuria") && frag_prefix == _L8("a"))
       
  4343     	Flag = 1;
       
  4344     else
       
  4345     	Flag = 0;
       
  4346     CleanupStack::PopAndDestroy(pFragment);
       
  4347     if (Flag) return KErrNone;
       
  4348     else return KErrArgument;
       
  4349 	}
       
  4350 TInt CSenXmlBCTest::CSenBaseFragment_EnsureNamespaceL( TTestResult& aResult )
       
  4351 	{
       
  4352 	TBool Flag;
       
  4353 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuria"),_L8("Test"),_L8("a:Test"));
       
  4354 	CleanupStack::PushL(pFragment);
       
  4355 	CSenElement& element = pFragment->AsElement();
       
  4356     element.AddElementL(_L8("Child"));
       
  4357     element.SetContentL(_L8("Test Content"));
       
  4358     pFragment->EnsureNamespace(_L8("a"));
       
  4359     CSenNamespace* frag_NameSpace;
       
  4360     frag_NameSpace = pFragment->Namespace(_L8("a"));
       
  4361     if(frag_NameSpace)
       
  4362     	Flag = 1;
       
  4363     else
       
  4364     	Flag = 0;
       
  4365     CleanupStack::PopAndDestroy(pFragment);
       
  4366     if (Flag) return KErrNone;
       
  4367     else return KErrArgument;
       
  4368 	}
       
  4369 TInt CSenXmlBCTest::CSenBaseFragment_DetachLL( TTestResult& aResult )
       
  4370 	{
       
  4371 	TBool Flag;
       
  4372 	_LIT8(KFragment,"<Test xmlns=\"nsuri\"><Child/>Test Content</Test>");
       
  4373 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre"));
       
  4374 	CleanupStack::PushL(pFragment);
       
  4375 	CSenElement& element = pFragment->AsElement();
       
  4376     element.AddElementL(_L8("Child"));
       
  4377     element.SetContentL(_L8("Test Content"));
       
  4378     CSenBaseElement *pParent=CSenBaseElement::NewL(_L8("parent"));
       
  4379     element.SetParent(pParent);
       
  4380     TRAPD(retval,pFragment->DetachL());
       
  4381     CleanupStack::PopAndDestroy(pFragment);
       
  4382     return retval;
       
  4383 	}	
       
  4384 TInt CSenXmlBCTest::CSenBaseFragment_SaveNamespacesLL( TTestResult& aResult )
       
  4385 	{
       
  4386     TBool Flag;
       
  4387     RStringPool stringPool;
       
  4388     stringPool.OpenL();
       
  4389     CleanupClosePushL(stringPool);
       
  4390     
       
  4391     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  4392     CleanupClosePushL(nsUriRString);
       
  4393     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  4394     CleanupClosePushL(nsPrefixRString);
       
  4395     RString localNameRString    = stringPool.OpenStringL(_L8("xmlns"));
       
  4396     CleanupClosePushL(localNameRString);
       
  4397     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  4398     CleanupClosePushL(valueRString);
       
  4399     
       
  4400     RAttribute attribute;
       
  4401     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  4402                    valueRString);
       
  4403     CleanupStack::Pop(4); 
       
  4404     CleanupClosePushL(attribute);
       
  4405 
       
  4406     RAttributeArray attrArray;
       
  4407     attrArray.AppendL(attribute);
       
  4408     CleanupClosePushL(attrArray); 
       
  4409       
       
  4410     CSenBaseFragment *pFragment = CSenBaseFragment::NewL(_L8("Nokia"));
       
  4411     CleanupStack::PushL(pFragment);
       
  4412     pFragment->SaveNamespacesL(attrArray,TRUE);
       
  4413     TPtrC8 frag_NameSpace = pFragment->NsUri();
       
  4414     if(frag_NameSpace == _L8("Value"))
       
  4415     	Flag = 1;
       
  4416     else
       
  4417     	Flag = 0;
       
  4418 
       
  4419 	CleanupStack::PopAndDestroy(pFragment);
       
  4420 	CleanupStack::PopAndDestroy(&attrArray);
       
  4421     CleanupStack::PopAndDestroy(&attribute);
       
  4422     CleanupStack::PopAndDestroy(&stringPool);
       
  4423     if (Flag)	return KErrNone;
       
  4424     else return KErrArgument;
       
  4425     }
       
  4426 TInt CSenXmlBCTest::CSenBaseFragment_ResetContentLL( TTestResult& aResult )
       
  4427 	{
       
  4428 	TBool Flag;
       
  4429 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4430 	CleanupStack::PushL(pFragment);
       
  4431 	CSenElement& element = pFragment->AsElement();
       
  4432     element.AddElementL(_L8("Child"));
       
  4433     element.SetContentL(_L8("Test Content"));
       
  4434     TPtrC8 frag_Content = pFragment->Content();
       
  4435     if(frag_Content == _L8("Test Content"))
       
  4436     	Flag =1;
       
  4437     else
       
  4438     	Flag =0;
       
  4439     pFragment->ResetContentL();
       
  4440     //frag_Content = pFragment->Content();
       
  4441 	if(pFragment->Content() == KNullDesC8)
       
  4442     	Flag =1;
       
  4443     else
       
  4444     	Flag =0;
       
  4445     CleanupStack::PopAndDestroy(pFragment);
       
  4446     if (Flag) return KErrNone;
       
  4447     else return KErrArgument;
       
  4448 	}
       
  4449 TInt CSenXmlBCTest::CSenBaseFragment_LocalNameL( TTestResult& aResult )
       
  4450 	{
       
  4451 	TBool Flag;
       
  4452 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4453 	CleanupStack::PushL(pFragment);
       
  4454 	CSenElement& element = pFragment->AsElement();
       
  4455     element.AddElementL(_L8("Child"));
       
  4456     element.SetContentL(_L8("Test Content"));
       
  4457     TPtrC8 frag_LocalName = pFragment->LocalName();
       
  4458     if(frag_LocalName == _L8("Test"))
       
  4459     	Flag =1;
       
  4460     else
       
  4461     	Flag =0;
       
  4462     CleanupStack::PopAndDestroy(pFragment);
       
  4463     if (Flag) return KErrNone;
       
  4464     else return KErrArgument;
       
  4465 	}
       
  4466 TInt CSenXmlBCTest::CSenBaseFragment_NsUriL( TTestResult& aResult )
       
  4467 	{
       
  4468 	TBool Flag;
       
  4469 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre"));
       
  4470 	CleanupStack::PushL(pFragment);
       
  4471 	CSenElement& element = pFragment->AsElement();
       
  4472     element.AddElementL(_L8("Child"));
       
  4473     element.SetContentL(_L8("Test Content"));
       
  4474     TPtrC8 frag_NsUri= pFragment->NsUri();
       
  4475     if(frag_NsUri == _L8("nsuri"))
       
  4476     	Flag =1;
       
  4477     else
       
  4478     	Flag =0;
       
  4479     CleanupStack::PopAndDestroy(pFragment);
       
  4480     if (Flag) return KErrNone;
       
  4481     else return KErrArgument;
       
  4482 	}
       
  4483 TInt CSenXmlBCTest::CSenBaseFragment_NsPrefixL( TTestResult& aResult )
       
  4484 	{
       
  4485 	TBool Flag;
       
  4486 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre"));
       
  4487 	CleanupStack::PushL(pFragment);
       
  4488 	CSenElement& element = pFragment->AsElement();
       
  4489     element.AddElementL(_L8("Child"));
       
  4490     element.SetContentL(_L8("Test Content"));
       
  4491     TPtrC8 frag_NsUri= pFragment->NsUri();
       
  4492     if(frag_NsUri == _L8("nsuri"))
       
  4493     	Flag =1;
       
  4494     else
       
  4495     	Flag =0;
       
  4496     CleanupStack::PopAndDestroy(pFragment);
       
  4497     if (Flag) return KErrNone;
       
  4498     else return KErrArgument;
       
  4499 	}
       
  4500 TInt CSenXmlBCTest::CSenBaseFragment_ExtractElementL( TTestResult& aResult )
       
  4501 	{
       
  4502 	TBool Flag;
       
  4503 	_LIT8(KFragment,"<Test xmlns=\"nsuri\"><Child/>Test Content</Test>");
       
  4504 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("nsuri"),_L8("Test"),_L8("Pre"));
       
  4505 	CleanupStack::PushL(pFragment);
       
  4506 	CSenElement& element = pFragment->AsElement();
       
  4507     element.AddElementL(_L8("Child"));
       
  4508     element.SetContentL(_L8("Test Content"));
       
  4509     CSenElement* Extr_Element = pFragment->ExtractElement();
       
  4510     CleanupStack::PushL(Extr_Element);
       
  4511     HBufC8* Ext_ElementBuf = Extr_Element->AsXmlL();
       
  4512     if(!(KFragment().Compare(*Ext_ElementBuf )))
       
  4513     	Flag =1;
       
  4514     else
       
  4515     	Flag =0;
       
  4516     
       
  4517     CleanupStack::PopAndDestroy(Extr_Element);
       
  4518     CleanupStack::PopAndDestroy(pFragment);
       
  4519     delete Ext_ElementBuf ;
       
  4520 
       
  4521     if (Flag) return KErrNone;
       
  4522     else return KErrArgument;
       
  4523 	}
       
  4524 TInt CSenXmlBCTest::CSenBaseFragment_SetAttributesLL( TTestResult& aResult )
       
  4525 	{
       
  4526     TBool Flag;   
       
  4527     RStringPool stringPool;
       
  4528     stringPool.OpenL();
       
  4529     CleanupClosePushL(stringPool);
       
  4530     
       
  4531     RString nsUriRString        = stringPool.OpenStringL(_L8("nsuri"));
       
  4532     CleanupClosePushL(nsUriRString);
       
  4533     RString nsPrefixRString     = stringPool.OpenStringL(_L8("pr"));
       
  4534     CleanupClosePushL(nsPrefixRString);
       
  4535     RString localNameRString    = stringPool.OpenStringL(_L8("xmlns"));
       
  4536     CleanupClosePushL(localNameRString);
       
  4537     RString valueRString        = stringPool.OpenStringL(_L8("Value"));
       
  4538     CleanupClosePushL(valueRString);
       
  4539     
       
  4540     RAttribute attribute;
       
  4541     attribute.Open(nsUriRString, nsPrefixRString, localNameRString, 
       
  4542                    valueRString);
       
  4543     CleanupStack::Pop(4); 
       
  4544     CleanupClosePushL(attribute);
       
  4545 
       
  4546     RAttributeArray attrArray;
       
  4547     attrArray.AppendL(attribute);
       
  4548     CleanupClosePushL(attrArray); 
       
  4549       
       
  4550     CSenBaseFragment *pFragment = CSenBaseFragment::NewL(_L8("Nokia"));
       
  4551     CleanupStack::PushL(pFragment);
       
  4552     pFragment->SetAttributesL(attrArray);
       
  4553     TPtrC8 frag_NameSpace = pFragment->NsUri();
       
  4554     if(frag_NameSpace == _L8("Value"))
       
  4555     	Flag = 1;
       
  4556     else
       
  4557     	Flag = 0;
       
  4558 
       
  4559 	CleanupStack::PopAndDestroy(pFragment);
       
  4560 	CleanupStack::PopAndDestroy(&attrArray);
       
  4561     CleanupStack::PopAndDestroy(&attribute);
       
  4562     CleanupStack::PopAndDestroy(&stringPool);
       
  4563     if (Flag)	return KErrNone;
       
  4564     else return KErrArgument;
       
  4565     }
       
  4566 TInt CSenXmlBCTest::CSenBaseFragment_ConsistsOfLL( TTestResult& aResult )
       
  4567 	{
       
  4568 	TBool Flag;
       
  4569 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4570 	CleanupStack::PushL(pFragment);
       
  4571 	CSenElement& element = pFragment->AsElement();
       
  4572     element.AddElementL(_L8("Child"));
       
  4573     element.SetContentL(_L8("Test Content"));
       
  4574     
       
  4575     CSenBaseFragment* pFragment2 = CSenBaseFragment::NewL(_L8("Test"));
       
  4576 	CleanupStack::PushL(pFragment2);
       
  4577 	CSenElement& element2 = pFragment2->AsElement();
       
  4578     element2.AddElementL(_L8("Child"));
       
  4579     element2.SetContentL(_L8("Test Content"));
       
  4580     
       
  4581     Flag = pFragment->ConsistsOfL(*pFragment2);
       
  4582     
       
  4583     CleanupStack::PopAndDestroy(pFragment2);
       
  4584     CleanupStack::PopAndDestroy(pFragment);
       
  4585     if (Flag) return KErrNone;
       
  4586     else return KErrArgument;
       
  4587 	}
       
  4588 TInt CSenXmlBCTest::CSenBaseFragment_ParseLL( TTestResult& aResult )	
       
  4589 	{
       
  4590 	SetupL();
       
  4591 	_LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\"&quot;\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  4592 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  4593 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  4594 <Element2 z=\"value4\">Content2</Element2>\
       
  4595 <Element3>Content3</Element3>\
       
  4596 <Element4/></a:Test>");
       
  4597 
       
  4598 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4599 	CleanupStack::PushL(pFragment);
       
  4600 	
       
  4601 	pFragment->SetReader(*iXmlReader);
       
  4602 	TRAPD(retVal,pFragment->ParseL(KInputString));
       
  4603     CleanupStack::PopAndDestroy(pFragment);
       
  4604     Teardown();
       
  4605     return retVal;
       
  4606 	}
       
  4607 	
       
  4608 TInt CSenXmlBCTest::CSenBaseFragment_ParseL1L( TTestResult& aResult )	
       
  4609 	{
       
  4610 	SetupL();
       
  4611 	_LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\"&quot;&#34;assa\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  4612 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  4613 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  4614 <Element2 z=\"value4\">Content2<Element2>\
       
  4615 <Element3>Content3</Element3>\
       
  4616 <Element4/></a:Test>");
       
  4617 
       
  4618 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4619 	CleanupStack::PushL(pFragment);
       
  4620 	
       
  4621 	pFragment->SetReader(*iXmlReader);
       
  4622 	TRAPD(retVal,pFragment->ParseL(KInputString));
       
  4623 	CleanupStack::PopAndDestroy(pFragment);
       
  4624     Teardown();
       
  4625     if (retVal == -993) return KErrNone;
       
  4626     else return retVal;
       
  4627 	}
       
  4628 
       
  4629 TInt CSenXmlBCTest::CSenBaseFragment_SetContentOfLL( TTestResult& aResult )
       
  4630 {
       
  4631 	CTestBaseFragment *pTestFragment = CTestBaseFragment::NewL(_L8("Test Fragment"));
       
  4632 	CleanupStack::PushL(pTestFragment);
       
  4633 	CSenElement& element = pTestFragment->AsElement();
       
  4634 	element.AddElementL(_L8("Test Child"));
       
  4635 	MSenElement& element1 = pTestFragment->SetContentOfL(_L8("Test Child"),_L8("Child Content"));
       
  4636 	TInt retVal = element1.Content().Compare(_L8("Child Content"));
       
  4637 	CleanupStack::PopAndDestroy(pTestFragment);
       
  4638 	return retVal;
       
  4639 }
       
  4640 TInt CSenXmlBCTest::CSenBaseFragment_ContentOfL( TTestResult& aResult )
       
  4641 {
       
  4642 	CTestBaseFragment *pTestFragment = CTestBaseFragment::NewL(_L8("Test Fragment"));
       
  4643 	CleanupStack::PushL(pTestFragment);
       
  4644 	pTestFragment->SetContentOfL(_L8("Test Child"),_L8("Child Content"));
       
  4645 	TInt retVal = pTestFragment->ContentOf(_L8("Test Child")).Compare(_L8("Child Content"));
       
  4646 	CleanupStack::PopAndDestroy(pTestFragment);
       
  4647 	return retVal;
       
  4648 }
       
  4649 
       
  4650 TInt CSenXmlBCTest::CSenXMLReader_ParserFeatureL( TTestResult& aResult )
       
  4651 	{
       
  4652 	TBool Flag;
       
  4653 	SetupL();
       
  4654 	_LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\"&quot;\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  4655 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  4656 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  4657 <Element2 z=\"value4\">&lt;Content2&quot;&gt;</Element2>\
       
  4658 <Element3>Content3</Element3>\
       
  4659 <Element4/></a:Test>");
       
  4660 
       
  4661 	CSenBaseFragment* pFragment = CSenBaseFragment::NewL(_L8("Test"));
       
  4662 	CleanupStack::PushL(pFragment);
       
  4663 	pFragment->SetReader(*iXmlReader);
       
  4664 	TInt feature = iXmlReader->ParserFeature();
       
  4665 	TRAPD(retVal,pFragment->ParseL(KInputString));
       
  4666     CleanupStack::PopAndDestroy(pFragment);
       
  4667     Teardown();
       
  4668     if (retVal == KErrNone && feature  == 64) return KErrNone;
       
  4669     else return KErrArgument;
       
  4670 	}
       
  4671 	
       
  4672 //	EXPORT_C void CSenXmlReader::ParseL(RFs &aRFs, const TDesC& aFileToParse)
       
  4673 
       
  4674 TInt CSenXmlBCTest::CSenXMLReader_ParseLL( TTestResult& aResult )
       
  4675 	{
       
  4676 	SetupL();
       
  4677 	CSenDomFragment* pFragment = CSenDomFragment::NewL();
       
  4678 	CleanupStack::PushL(pFragment);
       
  4679 	pFragment->SetReader(*iXmlReader);
       
  4680 	iXmlReader->SetContentHandler(*pFragment);
       
  4681 	_LIT(KFile,"c:\\wf_constraint_elem.xml");
       
  4682 	RFs fs;
       
  4683 	CleanupClosePushL(fs);
       
  4684 	TRAPD(rFile, fs.Connect());
       
  4685 	TRAPD(retVal,iXmlReader->ParseL(fs,KFile));
       
  4686 	CleanupStack::PopAndDestroy();
       
  4687 	CleanupStack::PopAndDestroy(pFragment);
       
  4688 	Teardown();
       
  4689 	return retVal;
       
  4690 	}
       
  4691 TInt CSenXmlBCTest::CSenDomFragment_NewL_L (TTestResult& aResult)
       
  4692     {
       
  4693     SetupL();
       
  4694     TBool Flag;
       
  4695     CSenDomFragment* pElement=CSenDomFragment::NewL();
       
  4696     CleanupStack::PushL(pElement);
       
  4697     if(pElement!=NULL)
       
  4698     	Flag=1;
       
  4699     else
       
  4700     	Flag=0;
       
  4701         /*EUNIT_ASSERT( Flag );*/
       
  4702     if(!Flag)
       
  4703     return KErrArgument;   
       
  4704 
       
  4705     CleanupStack::PopAndDestroy(pElement);
       
  4706     Teardown();
       
  4707     return KErrNone;
       
  4708     }
       
  4709     
       
  4710 TInt CSenXmlBCTest::CSenDomFragment_NewL_1L (TTestResult& aResult)
       
  4711     {
       
  4712     SetupL();
       
  4713     TBool Flag;
       
  4714     CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia"));
       
  4715     CleanupStack::PushL(ele);
       
  4716     CSenElement* parent = ele->Parent();
       
  4717     CSenDomFragment* pElement=CSenDomFragment::NewL(*ele);
       
  4718     CleanupStack::PushL(pElement);
       
  4719     if(pElement!=NULL)
       
  4720     	Flag=1;
       
  4721     else
       
  4722     	Flag=0;
       
  4723         /*EUNIT_ASSERT( Flag );*/
       
  4724     if(!Flag)
       
  4725     return KErrArgument;   
       
  4726 
       
  4727     CleanupStack::PopAndDestroy(pElement);
       
  4728     CleanupStack::PopAndDestroy(ele);
       
  4729     Teardown();
       
  4730     return KErrNone;
       
  4731     }
       
  4732 	
       
  4733 TInt CSenXmlBCTest::CSenDomFragment_NewL_2L (TTestResult& aResult)
       
  4734     {
       
  4735     SetupL();
       
  4736     TBool Flag;
       
  4737     CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("Nokia"));
       
  4738     CleanupStack::PushL(pElement);
       
  4739     if(pElement!=NULL)
       
  4740     	Flag=1;
       
  4741     else
       
  4742     	Flag=0;
       
  4743         /*EUNIT_ASSERT( Flag );*/
       
  4744     if(!Flag)
       
  4745     return KErrArgument;   
       
  4746 
       
  4747     CleanupStack::PopAndDestroy(pElement);
       
  4748     Teardown();
       
  4749     return KErrNone;
       
  4750     }
       
  4751 
       
  4752 TInt CSenXmlBCTest::CSenDomFragment_NewL_3L (TTestResult& aResult)
       
  4753     {
       
  4754     SetupL();
       
  4755     TBool Flag;
       
  4756     CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"));
       
  4757     CleanupStack::PushL(pElement);
       
  4758     if(pElement!=NULL)
       
  4759     	Flag=1;
       
  4760     else
       
  4761     	Flag=0;
       
  4762         /*EUNIT_ASSERT( Flag );*/
       
  4763     if(!Flag)
       
  4764     return KErrArgument;   
       
  4765 
       
  4766     CleanupStack::PopAndDestroy(pElement);
       
  4767     Teardown();
       
  4768     return KErrNone;
       
  4769     }
       
  4770 
       
  4771 TInt CSenXmlBCTest::CSenDomFragment_NewL_4L (TTestResult& aResult)
       
  4772     {
       
  4773     SetupL();
       
  4774     TBool Flag;
       
  4775     CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"));
       
  4776     CleanupStack::PushL(pElement);
       
  4777     if(pElement!=NULL)
       
  4778     	Flag=1;
       
  4779     else
       
  4780     	Flag=0;
       
  4781         /*EUNIT_ASSERT( Flag );*/
       
  4782     if(!Flag)
       
  4783     return KErrArgument;   
       
  4784 
       
  4785     CleanupStack::PopAndDestroy(pElement);
       
  4786     Teardown();
       
  4787     return KErrNone;
       
  4788     }
       
  4789     
       
  4790 TInt CSenXmlBCTest::CSenDomFragment_NewL_5L (TTestResult& aResult)
       
  4791     {
       
  4792     SetupL();
       
  4793     TBool Flag;
       
  4794     RAttributeArray aAttrs;
       
  4795     CSenDomFragment* pElement=CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs);
       
  4796     CleanupStack::PushL(pElement);
       
  4797     if(pElement!=NULL)
       
  4798     	Flag=1;
       
  4799     else
       
  4800     	Flag=0;
       
  4801         /*EUNIT_ASSERT( Flag );*/
       
  4802     if(!Flag)
       
  4803     return KErrArgument;   
       
  4804 
       
  4805     CleanupStack::PopAndDestroy(pElement);
       
  4806     Teardown();
       
  4807     return KErrNone;
       
  4808     }
       
  4809     
       
  4810 TInt CSenXmlBCTest::CSenDomFragment_NewL_6L (TTestResult& aResult)
       
  4811     {
       
  4812     SetupL();
       
  4813     TBool Flag;
       
  4814     RAttributeArray aAttrs;
       
  4815     CSenBaseElement* ele = CSenBaseElement::NewL(_L8("Nokia"));
       
  4816     CleanupStack::PushL(ele);
       
  4817     CSenElement* parent = ele->Parent();
       
  4818     CSenDomFragment* pElement = CSenDomFragment::NewL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs, *parent);
       
  4819     CleanupStack::PushL(pElement);
       
  4820     if(pElement!=NULL)
       
  4821     	Flag=1;
       
  4822     else
       
  4823     	Flag=0;
       
  4824         /*EUNIT_ASSERT( Flag );*/
       
  4825     if(!Flag)
       
  4826     return KErrArgument;   
       
  4827 
       
  4828     CleanupStack::PopAndDestroy(pElement);
       
  4829     CleanupStack::PopAndDestroy(ele);
       
  4830     Teardown();
       
  4831     return KErrNone;
       
  4832     }
       
  4833 /*	
       
  4834 TInt CSenXmlBCTest::CSenDomFragment_ExpandLL (TTestResult& aResult)
       
  4835     {
       
  4836     SetupL();
       
  4837     TBool Flag;
       
  4838     RAttributeArray aAttrs;
       
  4839     CSenDomFragment* pElement=CSenDomFragment::NewL();
       
  4840     
       
  4841     CleanupStack::PushL(pElement);
       
  4842 	pElement->ExpandL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"), aAttrs);
       
  4843     CleanupStack::PopAndDestroy(pElement);
       
  4844     Teardown();
       
  4845     return KErrNone;
       
  4846     }
       
  4847     
       
  4848 TInt CSenXmlBCTest::CSenDomFragment_ResumeParsingFromLL (TTestResult& aResult)
       
  4849     {
       
  4850     SetupL();
       
  4851     TBool Flag;
       
  4852     RAttributeArray aAttrs;
       
  4853     CSenDomFragment* pElement=CSenDomFragment::NewL();
       
  4854     
       
  4855     CleanupStack::PushL(pElement);
       
  4856 	pElement->ResumeParsingFromL(_L8("nsuri"),_L8("Nokia"),_L8("n:Nokia"));
       
  4857     CleanupStack::PopAndDestroy(pElement);
       
  4858     Teardown();
       
  4859     return KErrNone;
       
  4860     }
       
  4861 */    
       
  4862     TInt CSenXmlBCTest::CSenDomFragment_ParseWithLL (TTestResult& aResult)
       
  4863     {
       
  4864     SetupL();
       
  4865     CSenXmlReader* aReader = CSenXmlReader::NewL();
       
  4866     CleanupStack::PushL(aReader);
       
  4867     
       
  4868     CSenDomFragment* pElement=CSenDomFragment::NewL();
       
  4869     CleanupStack::PushL(pElement);
       
  4870     pElement->ParseWithL(*aReader);
       
  4871     CleanupStack::PopAndDestroy(pElement);
       
  4872     CleanupStack::PopAndDestroy(aReader);
       
  4873     
       
  4874     Teardown();
       
  4875     return KErrNone;
       
  4876     }
       
  4877 
       
  4878     TInt CSenXmlBCTest::CSenDomFragment_SetAttributesLL (TTestResult& aResult)
       
  4879     {
       
  4880     SetupL();
       
  4881     TBool Flag;
       
  4882     RAttributeArray aAttrs;
       
  4883     CSenDomFragment* pElement=CSenDomFragment::NewL();
       
  4884     pElement->SetAttributesL(aAttrs);
       
  4885     CleanupStack::PushL(pElement);
       
  4886 
       
  4887     CleanupStack::PopAndDestroy(pElement);
       
  4888     Teardown();
       
  4889     return KErrNone;
       
  4890     }
       
  4891 TInt CSenXmlBCTest::CSenDomFragment_ParseL1L( TTestResult& aResult )	
       
  4892 	{
       
  4893 	SetupL();
       
  4894 	_LIT8(KInputString, "<?xml version=\"1.0\" encoding=\"utf-8\" ?> <a:Test character=\"&quot;&#34;assa\" xmlns=\"nsuri\" xmlns:a=\"nasuria\" \
       
  4895 xmlns:b=\"nasurib\" a:x=\"value1\" b:z=\"value2\">\
       
  4896 <Element1 xmlns:c=\"nsuric\" c:x=\"value3\">Content1</Element1>\
       
  4897 <Element2 z=\"value4\">Content2<Element2>\
       
  4898 <Element3>Content3</Element3>\
       
  4899 <Element4/></a:Test>");
       
  4900 
       
  4901 	CSenDomFragment* pFragment = CSenDomFragment::NewL(_L8("Test"));
       
  4902 	CleanupStack::PushL(pFragment);
       
  4903 	
       
  4904 	pFragment->SetReader(*iXmlReader);
       
  4905 	TRAPD(retVal,pFragment->ParseL(KInputString));
       
  4906 	CleanupStack::PopAndDestroy(pFragment);
       
  4907     Teardown();
       
  4908     if (retVal == -993) return KErrNone;
       
  4909     else return retVal;
       
  4910 	}    
       
  4911 /*    
       
  4912 TInt CSenXmlBCTest::CSenDomFragment_ConsistsOfLL()
       
  4913 	{
       
  4914     SetupL();
       
  4915     CSenDomFragment* pFragmentA=CSenDomFragment::NewL(_L8("Nokia"));
       
  4916     CleanupStack::PushL(pFragmentA);
       
  4917     CSenElement pElement=pFragmentA->AsElement();
       
  4918     
       
  4919     
       
  4920     
       
  4921     
       
  4922     
       
  4923     
       
  4924     
       
  4925     
       
  4926     
       
  4927     
       
  4928     
       
  4929     
       
  4930     
       
  4931     
       
  4932     
       
  4933     CSenDomFragment* pChildFragment1A=CSenDomFragment::NewL(_L8("Asp"));
       
  4934     CleanupStack::PushL(pChild1A);
       
  4935     CSenDomFragment* pChild2A=CSenDomFragment::NewL(_L8("WebServices"));
       
  4936     CleanupStack::PushL(pChild2A);
       
  4937     pElementA->SetContentL(_L8("Nokia organisation structure"));
       
  4938     pElementA->AsElement()
       
  4939     pElementA->AddElementL(*pChild1A);
       
  4940     pElementA->AddElementL(*pChild2A);
       
  4941     
       
  4942     CSenDomFragment* pElementB=CSenDomFragment::NewL(_L8("Nokia"));
       
  4943     CleanupStack::PushL(pElementB);
       
  4944     CSenDomFragment* pChild1B=CSenDomFragment::NewL(_L8("Asp"));
       
  4945     CleanupStack::PushL(pChild1A);
       
  4946     CSenDomFragment* pChild2B=CSenDomFragment::NewL(_L8("WebServices"));
       
  4947     CleanupStack::PushL(pChild2B);
       
  4948     pElementB->SetContentL(_L8("Nokia organisation structure"));
       
  4949     pElementB->AddElementL(*pChild1B);
       
  4950     pElementB->AddElementL(*pChild2B);
       
  4951     
       
  4952     TBool ConsistOfFlag=pElementB->ConsistsOfL(*pElementA);
       
  4953     EUNIT_ASSERT( ConsistOfFlag );
       
  4954     CleanupStack::Pop(2);
       
  4955     CleanupStack::PopAndDestroy(pElementB);
       
  4956     CleanupStack::Pop(2);
       
  4957     CleanupStack::PopAndDestroy(pElementA);
       
  4958     Teardown();
       
  4959     return KErrNone;
       
  4960     }
       
  4961 */
       
  4962 
       
  4963 TInt CSenXmlBCTest::CSenNamespace_NewL_L (TTestResult& aResult)
       
  4964     {
       
  4965     SetupL();
       
  4966     TBool Flag;
       
  4967     CSenNamespace* pElement=CSenNamespace::NewL(_L8("n:"),_L8("nsuri"));
       
  4968     CleanupStack::PushL(pElement);
       
  4969     if(pElement!=NULL)
       
  4970     	Flag=1;
       
  4971     else
       
  4972     	Flag=0;
       
  4973         /*EUNIT_ASSERT( Flag );*/
       
  4974     if(!Flag)
       
  4975     return KErrArgument;   
       
  4976 
       
  4977     CleanupStack::PopAndDestroy(pElement);
       
  4978     Teardown();
       
  4979     return KErrNone;
       
  4980     }
       
  4981     
       
  4982 TInt CSenXmlBCTest::CSenNamespace_NewLC_L (TTestResult& aResult)
       
  4983     {
       
  4984     SetupL();
       
  4985     TBool Flag;
       
  4986     CSenNamespace* pElement=CSenNamespace::NewLC(_L8("n:"),_L8("nsuri"));
       
  4987     if(pElement!=NULL)
       
  4988     	Flag=1;
       
  4989     else
       
  4990     	Flag=0;
       
  4991         /*EUNIT_ASSERT( Flag );*/
       
  4992     if(!Flag)
       
  4993     return KErrArgument;   
       
  4994 
       
  4995     CleanupStack::PopAndDestroy(pElement);
       
  4996     Teardown();
       
  4997     return KErrNone;
       
  4998     }
       
  4999     
       
  5000  TInt CSenXmlBCTest::CSenNamespace_NewL_1L (TTestResult& aResult)
       
  5001     {
       
  5002     SetupL();
       
  5003     TBool Flag;
       
  5004     CSenNamespace* pElement=CSenNamespace::NewL(_L8("nsuri"));
       
  5005     CleanupStack::PushL(pElement);
       
  5006     if(pElement!=NULL)
       
  5007     	Flag=1;
       
  5008     else
       
  5009     	Flag=0;
       
  5010         /*EUNIT_ASSERT( Flag );*/
       
  5011     if(!Flag)
       
  5012     return KErrArgument;   
       
  5013 
       
  5014     CleanupStack::PopAndDestroy(pElement);
       
  5015     Teardown();
       
  5016     return KErrNone;
       
  5017     }
       
  5018     
       
  5019  TInt CSenXmlBCTest::CSenNamespace_NewLC_1L (TTestResult& aResult)
       
  5020     {
       
  5021     SetupL();
       
  5022     TBool Flag;
       
  5023     CSenNamespace* pElement=CSenNamespace::NewLC(_L8("nsuri"));
       
  5024     if(pElement!=NULL)
       
  5025     	Flag=1;
       
  5026     else
       
  5027     	Flag=0;
       
  5028         /*EUNIT_ASSERT( Flag );*/
       
  5029     if(!Flag)
       
  5030     return KErrArgument;   
       
  5031 
       
  5032     CleanupStack::PopAndDestroy(pElement);
       
  5033     Teardown();
       
  5034     return KErrNone;
       
  5035     }
       
  5036     
       
  5037 TInt CSenXmlBCTest::CSenNamespace_MatchesL_L (TTestResult& aResult)
       
  5038     {
       
  5039     SetupL();
       
  5040     TBool Flag;
       
  5041     CSenNamespace* pElement = CSenNamespace::NewL(_L8("nsuri"));
       
  5042     CSenNamespace* pEle = CSenNamespace::NewL(_L8("nsuri"));
       
  5043 
       
  5044     CleanupStack::PushL(pElement);
       
  5045     CleanupStack::PushL(pEle);
       
  5046     
       
  5047     
       
  5048     if(pElement!=NULL && pEle!=NULL)
       
  5049     	Flag = pEle->MatchesL(*pElement);
       
  5050     else
       
  5051     	Flag=0;
       
  5052         /*EUNIT_ASSERT( Flag );*/
       
  5053     if(!Flag)
       
  5054     return KErrArgument;   
       
  5055 
       
  5056     CleanupStack::PopAndDestroy(pEle);
       
  5057     CleanupStack::PopAndDestroy(pElement);
       
  5058     
       
  5059     Teardown();
       
  5060     return KErrNone;
       
  5061     }
       
  5062     
       
  5063 TInt CSenXmlBCTest::CSenNamespace_InsertLL (TTestResult& aResult)
       
  5064     {
       
  5065     SetupL();
       
  5066     TBool Flag;
       
  5067     const TInt KFlatBufSize = 64;
       
  5068 	CBufFlat *pBuf = CBufFlat::NewL(KFlatBufSize);
       
  5069 	CleanupStack::PushL(pBuf);
       
  5070     RBufWriteStream bufWs(*pBuf);
       
  5071     CleanupClosePushL(bufWs); 
       
  5072       
       
  5073     CSenNamespace* pElement = CSenNamespace::NewL(_L8("nsuri"));
       
  5074     CleanupStack::PushL(pElement);
       
  5075 	
       
  5076     pElement->InsertL(bufWs);
       
  5077     CleanupStack::PopAndDestroy(pElement);
       
  5078 	CleanupStack::PopAndDestroy(); // bufWs.Close();
       
  5079     CleanupStack::PopAndDestroy(); // pBuf;    
       
  5080     Teardown();
       
  5081     return KErrNone;
       
  5082     }
       
  5083     
       
  5084     
       
  5085     
       
  5086     
       
  5087 TInt CSenXmlBCTest::CSenXmlReader_NewL_L (TTestResult& aResult)
       
  5088     {
       
  5089     SetupL();
       
  5090     TBool Flag;
       
  5091     CSenXmlReader* pElement=CSenXmlReader::NewL();
       
  5092     if(pElement!=NULL)
       
  5093     	Flag=1;
       
  5094     else
       
  5095     	Flag=0;
       
  5096         /*EUNIT_ASSERT( Flag );*/
       
  5097     if(!Flag)
       
  5098     return KErrArgument;   
       
  5099 
       
  5100     delete pElement;
       
  5101     pElement = NULL;
       
  5102     Teardown();
       
  5103     return KErrNone;
       
  5104     }
       
  5105     
       
  5106 TInt CSenXmlBCTest::CSenXmlReader_NewLC_L (TTestResult& aResult)
       
  5107     {
       
  5108     SetupL();
       
  5109     TBool Flag;
       
  5110     CSenXmlReader* pElement=CSenXmlReader::NewLC();
       
  5111     if(pElement!=NULL)
       
  5112     	Flag=1;
       
  5113     else
       
  5114     	Flag=0;
       
  5115         /*EUNIT_ASSERT( Flag );*/
       
  5116     if(!Flag)
       
  5117     return KErrArgument;   
       
  5118 
       
  5119     CleanupStack::PopAndDestroy(pElement);
       
  5120     Teardown();
       
  5121     return KErrNone;
       
  5122     }
       
  5123     
       
  5124 TInt CSenXmlBCTest::CSenXmlReader_NewL_1L (TTestResult& aResult)
       
  5125     {
       
  5126     SetupL();
       
  5127     TBool Flag;
       
  5128     TInt param = 1;
       
  5129     CSenXmlReader* pElement=CSenXmlReader::NewL(param);
       
  5130     CleanupStack::PushL(pElement);
       
  5131     if(pElement!=NULL)
       
  5132     	Flag=1;
       
  5133     else
       
  5134     	Flag=0;
       
  5135         /*EUNIT_ASSERT( Flag );*/
       
  5136     if(!Flag)
       
  5137     return KErrArgument;   
       
  5138 
       
  5139     CleanupStack::PopAndDestroy(pElement);
       
  5140     Teardown();
       
  5141     return KErrNone;
       
  5142     }
       
  5143     
       
  5144 TInt CSenXmlBCTest::CSenXmlReader_NewLC_1L (TTestResult& aResult)
       
  5145     {
       
  5146     SetupL();
       
  5147     TBool Flag;
       
  5148     TInt param = 1;
       
  5149     CSenXmlReader* pElement=CSenXmlReader::NewLC(param);
       
  5150     if(pElement!=NULL)
       
  5151     	Flag=1;
       
  5152     else
       
  5153     	Flag=0;
       
  5154         /*EUNIT_ASSERT( Flag );*/
       
  5155     if(!Flag)
       
  5156     return KErrArgument;   
       
  5157 
       
  5158     CleanupStack::PopAndDestroy(pElement);
       
  5159     Teardown();
       
  5160     return KErrNone;
       
  5161     }
       
  5162     
       
  5163 TInt CSenXmlBCTest::CSenXmlReader_NewL_2L (TTestResult& aResult)
       
  5164     {
       
  5165     SetupL();
       
  5166     TBool Flag;
       
  5167     CSenXmlReader* pElement=CSenXmlReader::NewL(_L8(""));
       
  5168     CleanupStack::PushL(pElement);
       
  5169     if(pElement!=NULL)
       
  5170     	Flag=1;
       
  5171     else
       
  5172     	Flag=0;
       
  5173         /*EUNIT_ASSERT( Flag );*/
       
  5174     if(!Flag)
       
  5175     return KErrArgument;   
       
  5176 
       
  5177     CleanupStack::PopAndDestroy(pElement);
       
  5178     Teardown();
       
  5179     return KErrNone;
       
  5180     }
       
  5181     
       
  5182 TInt CSenXmlBCTest::CSenXmlReader_NewLC_2L (TTestResult& aResult)
       
  5183     {
       
  5184     SetupL();
       
  5185     TBool Flag;
       
  5186     CSenXmlReader* pElement=CSenXmlReader::NewLC(_L8(""));
       
  5187     if(pElement!=NULL)
       
  5188     	Flag=1;
       
  5189     else
       
  5190     	Flag=0;
       
  5191         /*EUNIT_ASSERT( Flag );*/
       
  5192     if(!Flag)
       
  5193     return KErrArgument;   
       
  5194 
       
  5195     CleanupStack::PopAndDestroy(pElement);
       
  5196     Teardown();
       
  5197     return KErrNone;
       
  5198     }
       
  5199     
       
  5200 TInt CSenXmlBCTest::CSenXmlReader_NewL_3L (TTestResult& aResult)
       
  5201     {
       
  5202     SetupL();
       
  5203     TBool Flag;
       
  5204     TInt param = 1;
       
  5205     CSenXmlReader* pElement=CSenXmlReader::NewL(_L8(""), param);
       
  5206     CleanupStack::PushL(pElement);
       
  5207     if(pElement!=NULL)
       
  5208     	Flag=1;
       
  5209     else
       
  5210     	Flag=0;
       
  5211         /*EUNIT_ASSERT( Flag );*/
       
  5212     if(!Flag)
       
  5213     return KErrArgument;   
       
  5214 
       
  5215     CleanupStack::PopAndDestroy(pElement);
       
  5216     Teardown();
       
  5217     return KErrNone;
       
  5218     }
       
  5219     
       
  5220 TInt CSenXmlBCTest::CSenXmlReader_NewLC_3L (TTestResult& aResult)
       
  5221     {
       
  5222     SetupL();
       
  5223     TBool Flag;
       
  5224     TInt param = 1;
       
  5225     CSenXmlReader* pElement=CSenXmlReader::NewLC(_L8(""), param);
       
  5226     if(pElement!=NULL)
       
  5227     	Flag=1;
       
  5228     else
       
  5229     	Flag=0;
       
  5230         /*EUNIT_ASSERT( Flag );*/
       
  5231     if(!Flag)
       
  5232     return KErrArgument;   
       
  5233 
       
  5234     CleanupStack::PopAndDestroy(pElement);
       
  5235     Teardown();
       
  5236     return KErrNone;
       
  5237     }
       
  5238 
       
  5239 TInt CSenXmlBCTest::CSenXmlReader_EnabledParserFeature_L (TTestResult& aResult)
       
  5240     {
       
  5241     SetupL();
       
  5242     TInt param = 1;
       
  5243     CSenXmlReader* pElement=CSenXmlReader::NewL(param);
       
  5244     CleanupStack::PushL(pElement);
       
  5245 /*    EUNIT_ASSERT_EQUALS(param,pElement->EnabledParserFeature());*/
       
  5246     TL(param == pElement->EnabledParserFeature());
       
  5247     CleanupStack::PopAndDestroy(pElement);
       
  5248     Teardown();
       
  5249     return KErrNone;
       
  5250     }
       
  5251     
       
  5252 TInt CSenXmlBCTest::CSenXmlUtils_ToUtf8LCL (TTestResult& aResult)
       
  5253     {
       
  5254     SetupL();
       
  5255     HBufC8* buf; 
       
  5256     
       
  5257     _LIT16(KText, "text");
       
  5258     _LIT8(KText1, "text");
       
  5259     buf = SenXmlUtils::ToUtf8LC(KText);
       
  5260     TPtr8 ptr = buf->Des();
       
  5261     TL(ptr == KText1);
       
  5262     CleanupStack::PopAndDestroy();
       
  5263     Teardown();
       
  5264     return KErrNone;
       
  5265     }
       
  5266  
       
  5267 TInt CSenXmlBCTest::CSenXmlUtils_StartsWithL (TTestResult& aResult)
       
  5268     {
       
  5269     SetupL();
       
  5270     HBufC8* buf; 
       
  5271     TBool retVal;
       
  5272     _LIT8(KText, "text");
       
  5273     _LIT8(KText1, "text1");
       
  5274     retVal = SenXmlUtils::StartsWith(KText, KText1);
       
  5275     TL(retVal == KErrNone);
       
  5276     Teardown();
       
  5277     return KErrNone;
       
  5278     }
       
  5279 
       
  5280 TInt CSenXmlBCTest::CSenXmlUtils_EndsWithL (TTestResult& aResult)
       
  5281     {
       
  5282     SetupL();
       
  5283     TBool retVal;
       
  5284     _LIT8(KText, "text");
       
  5285     _LIT8(KText1, "text1");
       
  5286     retVal = SenXmlUtils::EndsWith(KText, KText1);
       
  5287     TL(retVal == KErrNone);
       
  5288 
       
  5289     Teardown();
       
  5290     return KErrNone;
       
  5291     }
       
  5292     
       
  5293 TInt CSenXmlBCTest::CSenXmlUtils_AttrValueL (TTestResult& aResult)
       
  5294     {
       
  5295     SetupL();
       
  5296 	RAttributeArray  array;   
       
  5297     _LIT8(KText, "text");
       
  5298     TPtrC8 ptr = SenXmlUtils::AttrValue(array, KText);
       
  5299     Teardown();
       
  5300     return KErrNone;
       
  5301     }
       
  5302 
       
  5303 TInt CSenXmlBCTest::CSenXmlUtils_AllocAttrValueLL(TTestResult& aResult)
       
  5304     {
       
  5305     SetupL();
       
  5306 	RAttributeArray  array;   
       
  5307     _LIT8(KText, "text");
       
  5308     HBufC8* ptr = SenXmlUtils::AllocAttrValueL(array, KText);
       
  5309     Teardown();
       
  5310     return KErrNone;
       
  5311     }
       
  5312     
       
  5313 TInt CSenXmlBCTest::CSenXmlUtils_DecodeHttpCharactersLL(TTestResult& aResult)
       
  5314     {
       
  5315     SetupL();
       
  5316     TBool retVal;
       
  5317     HBufC8* ptr = NULL;
       
  5318     _LIT8(KText, "text");
       
  5319     retVal = SenXmlUtils::DecodeHttpCharactersL(KText, ptr);
       
  5320     TL(retVal == KErrNone);
       
  5321 
       
  5322     Teardown();
       
  5323     return KErrNone;
       
  5324     }
       
  5325     
       
  5326     
       
  5327 TInt CSenXmlBCTest::CSenXmlUtils_DecodeHttpCharactersLCL(TTestResult& aResult)
       
  5328     {
       
  5329     SetupL();
       
  5330     TBool retVal;
       
  5331     _LIT8(KText, "text");
       
  5332     HBufC8* buf = SenXmlUtils::DecodeHttpCharactersLC(KText);
       
  5333     TPtr8 ptr = buf->Des();
       
  5334     CleanupStack::PopAndDestroy();
       
  5335     
       
  5336     Teardown();
       
  5337     return KErrNone;
       
  5338     }
       
  5339     
       
  5340 
       
  5341 TInt CSenXmlBCTest::CSenXmlUtils_NsPrefixL(TTestResult& aResult)
       
  5342     {
       
  5343     SetupL();
       
  5344     _LIT8(KText, "m:");
       
  5345     _LIT8(KText1, "m");
       
  5346     
       
  5347     TPtrC8 ptr = SenXmlUtils::NsPrefix(KText);
       
  5348     //TL(ptr == KText1);
       
  5349     Teardown();
       
  5350     return KErrNone;
       
  5351     }
       
  5352     
       
  5353 TInt CSenXmlBCTest::CSenXmlUtils_LocalNameL(TTestResult& aResult)
       
  5354     {
       
  5355     SetupL();
       
  5356     _LIT8(KText, "http:\\");
       
  5357     _LIT8(KText1, "\\");
       
  5358     TPtrC8 ptr = SenXmlUtils::LocalName(KText);
       
  5359     //TL(ptr == KText1);
       
  5360     Teardown();
       
  5361     return KErrNone;
       
  5362     }
       
  5363     
       
  5364 TInt CSenXmlBCTest::CSenXmlUtils_RemoveAttributeLL(TTestResult& aResult)
       
  5365     {
       
  5366     SetupL();
       
  5367     _LIT8(KText, "text");
       
  5368     _LIT8(KText1, "text1");
       
  5369 	CSenBaseElement* element = CSenBaseElement::NewL(KText);
       
  5370 	CSenBaseAttribute* attr = CSenBaseAttribute::NewL(KText, KText1);
       
  5371     attr = SenXmlUtils::RemoveAttributeL(*element, KText);
       
  5372     
       
  5373     Teardown();
       
  5374     return KErrNone;
       
  5375     }
       
  5376     
       
  5377 TInt CSenXmlBCTest::CSenXmlUtils_RemoveAttributeL1L(TTestResult& aResult)
       
  5378     {
       
  5379     SetupL();
       
  5380     _LIT8(KText, "text");
       
  5381     _LIT8(KText1, "text1");
       
  5382 	CSenBaseElement* element = CSenBaseElement::NewL(KText);
       
  5383 	CSenBaseAttribute* attr = CSenBaseAttribute::NewL(KText, KText1);
       
  5384 	CSenBaseAttribute* attr1 = CSenBaseAttribute::NewL(KText, KText1);
       
  5385 	
       
  5386 	
       
  5387     attr = SenXmlUtils::RemoveAttributeL(*element, attr1);
       
  5388     
       
  5389     Teardown();
       
  5390     return KErrNone;
       
  5391     }
       
  5392     
       
  5393 TInt CSenXmlBCTest::CSenXmlUtils_AddAttributeLL(TTestResult& aResult)
       
  5394     {
       
  5395     SetupL();
       
  5396     _LIT8(KText, "text");
       
  5397 	CSenBaseElement* element = CSenBaseElement::NewL(KText);
       
  5398 	
       
  5399     TDesC8 desc = SenXmlUtils::AddAttributeL(*element, KText,  KText , KText );
       
  5400     
       
  5401     Teardown();
       
  5402     return KErrNone;
       
  5403     }
       
  5404     
       
  5405 TInt CSenXmlBCTest::CSenXmlUtils_AddAttributeL1L(TTestResult& aResult)
       
  5406     {
       
  5407     SetupL();
       
  5408     _LIT8(KText, "text");
       
  5409     _LIT8(KText1, "text1");
       
  5410 	CSenBaseElement* element = CSenBaseElement::NewL(KText);
       
  5411     TDesC8 desc = SenXmlUtils::AddAttributeL(*element, KText,  KText );
       
  5412     
       
  5413     Teardown();
       
  5414     return KErrNone;
       
  5415     }
       
  5416 
       
  5417 TInt CSenXmlBCTest::CSenXmlUtils_AddAttributeL2L(TTestResult& aResult)
       
  5418     {
       
  5419     SetupL();
       
  5420     _LIT8(KText, "text");
       
  5421     _LIT8(KText1, "text1");
       
  5422 	CSenBaseElement* element = CSenBaseElement::NewL(KText);
       
  5423 	CSenBaseAttribute* attr = CSenBaseAttribute::NewL(KText, KText1);
       
  5424 	
       
  5425     TDesC8 desc = SenXmlUtils::AddAttributeL(*element, attr);
       
  5426     
       
  5427     Teardown();
       
  5428     return KErrNone;
       
  5429     }
       
  5430 TInt CSenXmlBCTest::CSenXmlUtils_EncodeHttpCharactersLCL(TTestResult& aResult)
       
  5431     {
       
  5432     SetupL();
       
  5433     TBool retVal;
       
  5434     _LIT8(KText, "text");
       
  5435     HBufC8* buf = SenXmlUtils::EncodeHttpCharactersLC(KText);
       
  5436     //TPtr8 ptr = buf->Des();
       
  5437     CleanupStack::PopAndDestroy();
       
  5438     
       
  5439     Teardown();
       
  5440     return KErrNone;
       
  5441     }
       
  5442 
       
  5443 TInt CSenXmlBCTest::CSenDomFragment_BaseConstructL( TTestResult& aResult )
       
  5444 {
       
  5445 	    SetupL();
       
  5446 
       
  5447 	CTestDomFragment *pTestFragment = CTestDomFragment::NewL(_L8("Test Fragment"));
       
  5448 	TInt retVal = 0;
       
  5449     CSenXmlReader* aReader = CSenXmlReader::NewL();
       
  5450     CleanupStack::PushL(aReader);
       
  5451 
       
  5452 	CleanupStack::PushL(pTestFragment);
       
  5453 	pTestFragment->BaseConstructL(*aReader);
       
  5454 	CleanupStack::PopAndDestroy(pTestFragment);
       
  5455     CleanupStack::PopAndDestroy(aReader);
       
  5456 	
       
  5457 	    Teardown();
       
  5458 
       
  5459 	return retVal;
       
  5460 }
       
  5461 
       
  5462 TInt CSenXmlBCTest::CSenBaseFragment_BaseConstructL( TTestResult& aResult )
       
  5463 {
       
  5464 	    SetupL();
       
  5465 
       
  5466 	CTestBaseFragment *pTestFragment = CTestBaseFragment::NewL(_L8("Test Fragment"));
       
  5467 	TInt retVal = 0;
       
  5468     CSenXmlReader* aReader = CSenXmlReader::NewL();
       
  5469     CleanupStack::PushL(aReader);
       
  5470 
       
  5471 	CleanupStack::PushL(pTestFragment);
       
  5472 	pTestFragment->BaseConstructL(*aReader);
       
  5473 	CleanupStack::PopAndDestroy(pTestFragment);
       
  5474     CleanupStack::PopAndDestroy(aReader);
       
  5475 	
       
  5476 	    Teardown();
       
  5477 
       
  5478 	return retVal;
       
  5479 }
       
  5480 //  END OF FILE