public bool ReprocessItem(int queueId) { DatasourceManager datasourceManager; DatasourceDataQueueItem queueItem; RawDataValue rawData; ConfiguredDatasource cds; IDataSource currentDatasource; DatasourceParameterType[] parameterTypes; queueItem = _db.ORManager.Get <DatasourceDataQueueItem>(queueId); rawData = _db.ORManager.Get <RawDataValue>(queueItem.RawDataId); cds = _db.ORManager.Get <ConfiguredDatasource>(rawData.ConfiguredDatasourceId); datasourceManager = new DatasourceManager(); currentDatasource = datasourceManager.GetDatasource(cds.DatasourceType.Id); //Load the parameter types parameterTypes = _db.GetParameterTypesForDatasource(cds.DatasourceType.Id); //Set up the datasource cds.InitializeDatasource(currentDatasource, parameterTypes); //Fake the web response SerializableWebResponse resp; resp = new SerializableWebResponse(); resp.Content = queueItem.Data; currentDatasource.SetResponse(resp); RawDataValue[] values; values = currentDatasource.Values; foreach (RawDataValue currValue in values) { if (!currValue.Success || currValue.Fuzzy) { return(false); } } //Save the new values foreach (RawDataValue currValue in values) { currValue.ConfiguredDatasourceId = cds.Id.Value; _db.BulkInsertRawData(values); } //Delete the extra state data _db.ORManager.Delete(queueItem); //If we get here, it must have worked! return(true); }
public void get_datasources_returns_list_of_defined_files_with_types_and_filenames_succesfully() { //gievn var sut = new DatasourceManager(); //when var result = sut.GetDatasourcesDetails(); //then Assert.IsInstanceOfType(result, typeof(IEnumerable <DatasourceDetail>)); }