Ejemplo n.º 1
0
        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>>();
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public static void AreEqual(XmlNode taskData, Documents documents, Catalog catalog, string currentPath)
        {
            var tskNodes = taskData.SelectNodes("TSK");

            LoggedDataAssert.AreEqual(tskNodes, currentPath, documents.LoggedData.ToList(), catalog);
        }
Ejemplo n.º 4
0
        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);
        }