示例#1
0
        public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
        {
            switch (name.ToLowerInvariant())
            {
            case FilesTable:
                return(new FilesSource((string)parameters[0], (bool)parameters[1], interCommunicator));

            case DirectoriesTable:
                return(new DirectoriesSource((string)parameters[0], (bool)parameters[1], interCommunicator));

            case ZipTable:
                return(new ZipSource((string)parameters[0], interCommunicator));

            case ProcessesName:
                return(new ProcessesSource(interCommunicator));

            case Self:
                return(new OsSource());

            case DllsTable:
                return(new DllSource((string)parameters[0], (bool)parameters[1], interCommunicator));
            }

            throw new NotSupportedException($"Unsupported row source {name}");
        }
示例#2
0
 public CsvSource(string filePath, string separator, bool hasHeader, int skipLines, InterCommunicator communicator)
 {
     _filePath     = filePath;
     _separator    = separator;
     _hasHeader    = hasHeader;
     _skipLines    = skipLines;
     _communicator = communicator;
 }
示例#3
0
 public override RowSource GetRowSource(string name, InterCommunicator communicator, params object[] parameters)
 {
     if (_whenChecked == WhenCheckedParameters.OnSchemaTableOrRowSourceGet)
     {
         _onGetTableOrRowSource(parameters);
     }
     return(new EntitySource <TestEntity>(_entities, new Dictionary <string, int>(), new Dictionary <int, Func <TestEntity, object> >()));
 }
示例#4
0
        public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
        {
            switch (name.ToLowerInvariant())
            {
            case "file":
                return(new FlatFileSource((string)parameters[0], interCommunicator));
            }

            throw new SourceNotFoundException(nameof(name));
        }
示例#5
0
        public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
        {
            switch (name.ToLowerInvariant())
            {
            case Dual:
                return(new DualRowSource());
            }

            throw new NotSupportedException(name);
        }
示例#6
0
文件: CsvSchema.cs 项目: Eibwen/Musoq
        public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
        {
            switch (name.ToLowerInvariant())
            {
            case FileTable:
                parameters[3] = Convert.ToInt32(parameters[3]);
                return((CsvSource)Activator.CreateInstance(typeof(CsvSource), parameters.ExpandParameters(interCommunicator)));
            }

            throw new NotSupportedException();
        }
示例#7
0
        public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
        {
            switch (name.ToLowerInvariant())
            {
            case "interval":
                return(new TimeSource(DateTimeOffset.Parse((string)parameters[0]), DateTimeOffset.Parse((string)parameters[1]),
                                      (string)parameters[2], interCommunicator));
            }

            throw new NotSupportedException($"Table {name} not found.");
        }
示例#8
0
        public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
        {
            switch (name)
            {
            case "commits":
                return(new CommitsSource((string)parameters[0], SchemaGitHelper.CommitsNameToIndexMap,
                                         SchemaGitHelper.CommitsIndexToMethodAccessMap));

            case "tags":
                return(new TagsSource((string)parameters[0], SchemaGitHelper.TagsNameToIndexMap,
                                      SchemaGitHelper.TagsIndexToMethodAccessMap));

            case "branches":
                return(new BranchesSource((string)parameters[0], SchemaGitHelper.BranchesNameToIndexMap,
                                          SchemaGitHelper.BranchesIndexToMethodAccessMap));
            }

            throw new NotSupportedException(name);
        }
示例#9
0
        public TimeSource(DateTimeOffset startAt, DateTimeOffset stopAt, string resolution, InterCommunicator communicator)
        {
            _startAt    = startAt;
            _resolution = resolution.ToLowerInvariant();

            switch (_resolution)
            {
            case "seconds":
                _stopAt = stopAt.Add(TimeSpan.FromMilliseconds(1));
                break;

            case "minutes":
                _stopAt = stopAt.AddSeconds(1);
                break;

            case "hours":
                _stopAt = stopAt.AddMinutes(1);
                break;

            case "days":
                _stopAt = stopAt.AddHours(1);
                break;

            case "months":
                _stopAt = stopAt.AddDays(1);
                break;

            case "years":
                _stopAt = stopAt.AddMonths(1);
                break;

            default:
                throw new NotSupportedException($"Chosen resolution '{_resolution}' is not supported.");
            }

            _communicator = communicator;
        }
示例#10
0
 public FilesSource(string path, bool useSubDirectories, InterCommunicator communicator)
 {
     _communicator = communicator;
     _source       = new DirectorySourceSearchOptions(path, useSubDirectories);
 }
示例#11
0
 public FlatFileSource(string filePath, InterCommunicator communicator)
 {
     _filePath     = filePath;
     _communicator = communicator;
 }
示例#12
0
 public DirectoriesSource(string path, bool recursive, InterCommunicator communicator)
 {
     _communicator = communicator;
     _source       = new DirectorySourceSearchOptions(path, recursive);
 }
示例#13
0
 public abstract RowSource GetRowSource(string name, InterCommunicator communicator, params object[] parameters);
示例#14
0
 public ZipSource(string zipPath, InterCommunicator communicator)
 {
     _zipPath      = zipPath;
     _communicator = communicator;
 }
示例#15
0
 public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
 {
     return(new TransientVariableSource(name));
 }
示例#16
0
 public DllSource(string path, bool useSubDirectories, InterCommunicator communicator)
     : base(path, useSubDirectories, communicator)
 {
 }
示例#17
0
 public override RowSource GetRowSource(string name, InterCommunicator communicator, params object[] parameters)
 {
     return(new JsonSource((string)parameters[0], communicator));
 }
示例#18
0
 public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
 {
     return(new TableMetadataSource(_columns));
 }
示例#19
0
 public TestDirectoriesSource(string path, bool recursive, InterCommunicator communicator)
     : base(path, recursive, communicator)
 {
 }
示例#20
0
 public ProcessesSource(InterCommunicator communicator)
 {
     _communicator = communicator;
 }
示例#21
0
 public override RowSource GetRowSource(string name, InterCommunicator interCommunicator, params object[] parameters)
 {
     return(new EntitySource <T>(_sources, TestNameToIndexMap, TestIndexToObjectAccessMap));
 }