public static void AreEqual(ApplicationDataModel applicationDataModel, ISO11783_TaskData isoTaskData, string cardPath) { var loggedData = applicationDataModel.Documents.LoggedData.ToList(); var tasks = isoTaskData.Items.Where(x => x.GetType() == typeof (TSK)).Cast<TSK>().ToList(); TskAssert.AreEqual(loggedData, tasks, applicationDataModel.Catalog, cardPath); }
public void GivenDataPathAndAdmWhenExportThenAdmIsExported() { var adm = new ApplicationDataModel(); _plugin.Export(adm, _dataPath); _exporterMock.Verify(x => x.Export(adm, Path.Combine(_dataPath, "TASKDATA"), It.IsAny<TaskDocumentWriter>()), Times.Once); }
public Documents Map(List<TSK> tsks, string dataPath, ApplicationDataModel.ADM.ApplicationDataModel dataModel, Dictionary<string, List<UniqueId>> linkedIds) { var tasksWithLoggedData = tsks.Where(task => task.Items != null && task.Items.OfType<TLG>().Any()).ToList(); _loggedDataMapper.Map(tasksWithLoggedData, dataPath, dataModel, linkedIds); var tasksWithoutLogData = tsks.Where(task => task.Items == null || !task.Items.OfType<TLG>().Any()).ToList(); var workOrders = _workOrderMapper.Map(tasksWithoutLogData, dataModel); dataModel.Documents.WorkOrders = workOrders; return dataModel.Documents; }
public void Setup() { _tsks = new List<TSK>(); _dataPath = Path.GetTempPath(); _documents = new Documents(); _dataModel = new ApplicationDataModel { Documents = _documents }; _loggedDataMapperMock = new Mock<ILoggedDataMapper>(); _workOrderMapperMock = new Mock<IWorkOrderMapper>(); _documentMapper = new DocumentMapper(_loggedDataMapperMock.Object, _workOrderMapperMock.Object); _linkedIds = new Dictionary<string, List<UniqueId>>(); }
public void Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties = null) { using (var taskWriter = new TaskDocumentWriter()) { var taskDataPath = Path.Combine(exportPath, "TASKDATA"); var iso11783TaskData = _exporter.Export(dataModel, taskDataPath, taskWriter); var filePath = Path.Combine(taskDataPath, FileName); if (iso11783TaskData != null) { var xml = Encoding.UTF8.GetString(taskWriter.XmlStream.ToArray()); File.WriteAllText(filePath, xml); LinkListWriter.Write(taskDataPath, taskWriter.Ids); } } }
public ApplicationDataModel.ADM.ApplicationDataModel Import(ISO11783_TaskData iso11783TaskData, string dataPath, ApplicationDataModel.ADM.ApplicationDataModel dataModel, Dictionary<string, List<UniqueId>> linkedIds) { if (dataModel.Catalog == null) dataModel.Catalog = CreateCatalog(); if (dataModel.Documents == null) dataModel.Documents = CreateDocuments(); if(dataModel.Documents.LoggedData == null) dataModel.Documents.LoggedData = new List<LoggedData>(); var isoObjects = iso11783TaskData.Items; if (isoObjects == null || isoObjects.Length == 0) return dataModel; var tasks = isoObjects.GetItemsOfType<TSK>(); _documentMapper.Map(tasks, dataPath, dataModel, linkedIds); return dataModel; }
public void Setup() { _linkIds = new Dictionary<string, List<UniqueId>>(); _taskData = new ISO11783_TaskData(); _dataPath = Path.GetTempPath(); _applicationDataModel = new ApplicationDataModel(); _documentMapperMock = new Mock<IDocumentMapper>(); _importer = new Importer(_documentMapperMock.Object); }
private static TaskDataDocument ConvertTaskDataFileToModel(string taskDataFile, ApplicationDataModel.ADM.ApplicationDataModel dataModel) { var taskDocument = new TaskDataDocument(); if (taskDocument.LoadFromFile(taskDataFile) == false) return taskDocument; var catalog = new Catalog(); catalog.Growers = taskDocument.Customers.Values.ToList(); catalog.Farms = taskDocument.Farms.Values.ToList(); catalog.Fields = taskDocument.Fields.Values.ToList(); catalog.GuidanceGroups = taskDocument.GuidanceGroups.Values.Select(x => x.Group).ToList(); catalog.GuidancePatterns = taskDocument.GuidanceGroups.Values.SelectMany(x => x.Patterns.Values).ToList(); catalog.Crops = taskDocument.Crops.Values.ToList(); catalog.CropZones = taskDocument.CropZones.Values.ToList(); catalog.DeviceElements = taskDocument.Machines.Values.ToList(); catalog.FieldBoundaries = taskDocument.FieldBoundaries; catalog.Ingredients = taskDocument.Ingredients; catalog.Prescriptions = taskDocument.RasterPrescriptions.Cast<Prescription>().ToList(); catalog.ContactInfo = taskDocument.Contacts; catalog.Products = AddAllProducts(taskDocument); dataModel.Catalog = catalog; var documents = new Documents(); documents.GuidanceAllocations = taskDocument.GuidanceAllocations; documents.LoggedData = taskDocument.Tasks; dataModel.Documents = documents; return taskDocument; }
public void Export(ApplicationDataModel.ADM.ApplicationDataModel dataModel, string exportPath, Properties properties = null) { }
public static void AreEqual(XmlNode taskData, ApplicationDataModel applicationDataModel, string currentPath, Dictionary<string, List<UniqueId>> linkList) { CatalogAssert.AreEqual(taskData, applicationDataModel.Catalog, linkList); DocumentsAssert.AreEqual(taskData, applicationDataModel.Documents, applicationDataModel.Catalog, currentPath); }
public void Setup() { _tsk = new TSK(); _tsks = new List<TSK>{ _tsk }; _dataPath = Path.GetTempPath(); _documents = new Documents(); _catalog = new Catalog(); _linkIds = new Dictionary<string, List<UniqueId>>(); _dataModel = new ApplicationDataModel(); _dataModel.Documents = _documents; _dataModel.Catalog = _catalog; _operationDataMapper = new Mock<IOperationDataMapper>(); _loggedDataMapper = new LoggedDataMapper(_operationDataMapper.Object); }
public void Setup() { _task = new TSK(); _taskList = new List<TSK> {_task}; _dataPath = Path.GetTempPath(); _dataModel = new ApplicationDataModel {Catalog = new Catalog(), Documents = new Documents()}; _linkedIds = new Dictionary<string, List<UniqueId>>(); _statusUpdateMapperMock = new Mock<IStatusUpdateMapper>(); _mapper = new WorkOrderMapper(_statusUpdateMapperMock.Object); }
public static void Export(IPlugin plugin, ApplicationDataModel.ADM.ApplicationDataModel applicationDataModel, string initializeString, string exportPath) { InitializePlugin(plugin, initializeString); plugin.Export(applicationDataModel, exportPath); }
public void Setup() { _applicationDataModel = new ApplicationDataModel { Catalog = new Catalog(), Documents = new Documents() }; _datacardPath = Path.GetTempPath(); _growerFarmFieldMapperMock = new Mock<IGrowerFarmFieldMapper>(); _cropZoneMapperMock = new Mock<ICropZoneMapper>(); _cropTypeMapperMock = new Mock<ICropTypeMapper>(); _taskMapperMock = new Mock<ITaskMapper>(); _exporter = new Exporter(_taskMapperMock.Object); }