public void ServiceMappingHelper_MapDbOutputs_WhenNoOutputsWithPaths_ExpectNoOutputMappings() { //------------Setup for test-------------------------- const string outputDefs = @"<z:anyType xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:d1p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.Ouput"" i:type=""d1p1:OutputDescription"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/""><d1p1:DataSourceShapes xmlns:d2p1=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><d2p1:anyType i:type=""d1p1:DataSourceShape""><d1p1:_x003C_Paths_x003E_k__BackingField><d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Dev2.Converters.Graph.DataTable"" i:type=""d5p1:DataTablePath""><_x003C_ActualPath_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Column1</_x003C_ActualPath_x003E_k__BackingField><_x003C_DisplayPath_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph""></_x003C_DisplayPath_x003E_k__BackingField><_x003C_OutputExpression_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph""></_x003C_OutputExpression_x003E_k__BackingField><_x003C_SampleData_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">the result</_x003C_SampleData_x003E_k__BackingField></d2p1:anyType></d1p1:_x003C_Paths_x003E_k__BackingField></d2p1:anyType></d1p1:DataSourceShapes><d1p1:Format>ShapedXML</d1p1:Format></z:anyType>"; var serviceMappingHelper = new ServiceMappingHelper(); IOutputDescription outputs = new OutputDescriptionSerializationService().Deserialize(outputDefs); outputs.DataSourceShapes.Add(new DataSourceShape()); DbService theService = CreateCountriesDbService(); theService.Recordset.Fields.Clear(); //------------Execute Test--------------------------- serviceMappingHelper.MapDbOutputs(outputs, ref theService, true); //------------Assert Results------------------------- Assert.AreEqual(0, theService.Recordset.Fields.Count); }
public void ServiceMappingHelper_MapDbOutputs_WhenOutputsWithPaths_ExpectTwoOutputMappings() { //------------Setup for test-------------------------- var outputDefs = @"<z:anyType xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:d1p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.Ouput"" i:type=""d1p1:OutputDescription"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/""><d1p1:DataSourceShapes xmlns:d2p1=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><d2p1:anyType i:type=""d1p1:DataSourceShape""><d1p1:_x003C_Paths_x003E_k__BackingField><d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Dev2.Converters.Graph.DataTable"" i:type=""d5p1:DataTablePath""><_x003C_ActualPath_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">CountryID</_x003C_ActualPath_x003E_k__BackingField><_x003C_DisplayPath_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">CountryID</_x003C_DisplayPath_x003E_k__BackingField><_x003C_OutputExpression_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">[[dbo_Pr_CitiesGetCountries().CountryID]]</_x003C_OutputExpression_x003E_k__BackingField><_x003C_SampleData_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">1__COMMA__2__COMMA__3__COMMA__4__COMMA__5__COMMA__6__COMMA__7__COMMA__8__COMMA__9__COMMA__10</_x003C_SampleData_x003E_k__BackingField></d2p1:anyType><d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Dev2.Converters.Graph.DataTable"" i:type=""d5p1:DataTablePath""><_x003C_ActualPath_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Description</_x003C_ActualPath_x003E_k__BackingField><_x003C_DisplayPath_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Description</_x003C_DisplayPath_x003E_k__BackingField><_x003C_OutputExpression_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">[[dbo_Pr_CitiesGetCountries().Description]]</_x003C_OutputExpression_x003E_k__BackingField><_x003C_SampleData_x003E_k__BackingField xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Afghanistan__COMMA__Albania__COMMA__Algeria__COMMA__Andorra__COMMA__Angola__COMMA__Argentina__COMMA__Armenia__COMMA__Australia__COMMA__Austria__COMMA__Azerbaijan</_x003C_SampleData_x003E_k__BackingField></d2p1:anyType></d1p1:_x003C_Paths_x003E_k__BackingField></d2p1:anyType></d1p1:DataSourceShapes><d1p1:Format>ShapedXML</d1p1:Format></z:anyType>"; var serviceMappingHelper = new ServiceMappingHelper(); IOutputDescription outputs = new OutputDescriptionSerializationService().Deserialize(outputDefs); outputs.DataSourceShapes.Add(new DataSourceShape()); DbService theService = CreateCountriesDbService(); theService.Recordset.Fields.Clear(); //------------Execute Test--------------------------- serviceMappingHelper.MapDbOutputs(outputs, ref theService, true); //------------Assert Results------------------------- Assert.AreEqual(2, theService.Recordset.Fields.Count); }
public void ServiceMappingHelper_MapDbOutputs_WhenSampleDataContainsCommaReplacement_Expect10SampleItems() { // // 2013.12.11 - COMMUNITY BUG - 341463 - Fixed test to include empty cells // //------------Setup for test-------------------------- var expectedData = CreateDbServiceLocationsDataTable(); // OutputDescription MUST contain empty cells!!! var outputDefs = XmlResource.Fetch("DbServiceLocationsOutputDescription"); var serviceMappingHelper = new ServiceMappingHelper(); var outputs = new OutputDescriptionSerializationService().Deserialize(outputDefs.ToString()); outputs.DataSourceShapes.Add(new DataSourceShape()); var theService = CreateCountriesDbService(); theService.Recordset.Fields.Clear(); //------------Execute Test--------------------------- serviceMappingHelper.MapDbOutputs(outputs, ref theService, true); //------------Assert Results------------------------- Assert.AreEqual(expectedData.Columns.Count, theService.Recordset.Fields.Count); for(var i = 0; i < expectedData.Rows.Count; i++) { var record = theService.Recordset.Records[i]; Assert.AreEqual(expectedData.Columns.Count, record.Cells.Length); for(var j = 0; j < expectedData.Columns.Count; j++) { var expected = expectedData.Rows[i][j]; var actual = record.Cells[j].Value; Assert.AreEqual(expected, actual); } } }