public void Test001_ExportRFDevices([ValueSource(nameof(aFormats))] FileFormat format, [Values(10, 50, 200, 1000)] int iCount) { SIGENCEScenarioToolTestCaseHelper.ShowTestCaseInformation(); //----------------------------------------------------------------- RFDeviceList dl = RFDeviceList.CreateRandomizedRFDeviceList(iCount, new PointLatLng(0, 0)); string strFilename = $"{Path.GetTempPath()}nunit_rfdevice.{DateTime.Now.ToString( "yyyyMMdd_HHmmssfff" )}.{format}"; switch (format) { case FileFormat.Xml: dl.SaveAsXml(strFilename); break; case FileFormat.Csv: dl.SaveAsCsv(strFilename); break; //case FileFormat.Json: // dl.SaveAsJson(strFilename); // break; } //----------------------------------------------------------------- Assert.True(File.Exists(strFilename)); }
/// <summary> /// Exports the RFDevices. /// </summary> /// <param name="devicelist">The devicelist.</param> /// <param name="fiExportFile">The fi export file.</param> private void ExportRFDevices(RFDeviceList devicelist, FileInfo fiExportFile) { this.Cursor = Cursors.Wait; try { switch (fiExportFile.Extension.ToLower()) { case ".csv": devicelist.SaveAsCsv(fiExportFile.FullName); MB.Information("File {0} successful created.", fiExportFile.Name); break; case ".json": devicelist.SaveAsJson(fiExportFile.FullName); MB.Information("File {0} successful created.", fiExportFile.Name); break; case ".xml": devicelist.SaveAsXml(fiExportFile.FullName); MB.Information("File {0} successful created.", fiExportFile.Name); break; //case ".sqlite": // devicelist.SaveAsSQLite( fiExportFile.FullName ); // MB.Information( "File {0} successful created." , fiExportFile.Name ); // break; case ".xlsx": SaveAsExcel(devicelist, fiExportFile.FullName); break; default: MB.Warning("The FileType '{0}' Is Currently Not Supported For Export!", fiExportFile.Extension.ToLower()); break; } } catch (Exception ex) { MB.Error(ex); } this.Cursor = Cursors.Arrow; }