Esempio n. 1
0
        public HttpMockServer(IRecordMatcher matcher)
        {
            instanceCount++;
            this.matcher = matcher;
            this.Records = new Records(matcher);

            if (Mode == HttpRecorderMode.Playback)
            {
                Records.EnqueueRange(sessionRecords);
            }
        }
Esempio n. 2
0
        private void Process(String[] filePaths, IRecordSourceFactory recordSourceFactory, IRecordMatcher recordMatcher, IRecordWriter2 recordWriter)
        {
            foreach (String filePath in filePaths)
              {
            var recordSource = recordSourceFactory.CreateSource(filePath);

            while (!recordMatcher.HasReachedMatchQuota && recordSource.GotRecord)
            {
              if (recordMatcher.IsMatch(recordSource))
              {
            recordWriter.WriteMatchedRecord(recordSource);
              }
              else
              {
            recordWriter.WriteUnmatchedRecord(recordSource);
              }

              recordSource.MoveToNextRecord();
            }

            recordSource.Close();
              }
        }
Esempio n. 3
0
 /// <summary>
 /// Sorts all records on the page
 /// </summary>
 /// <param name="ClusterKey"></param>
 public virtual void Sort(IRecordMatcher SortKey)
 {
     this._Elements.Sort(SortKey);
     this._Version++;
 }
Esempio n. 4
0
 public Records(Dictionary <string, Queue <RecordEntry> > records, IRecordMatcher matcher)
 {
     this.sessionRecords = new Dictionary <string, Queue <RecordEntry> >(records);
     this.matcher        = matcher;
 }
Esempio n. 5
0
 public Records(IRecordMatcher matcher)
     : this(new Dictionary <string, Queue <RecordEntry> >(), matcher)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Turn off sorting
 /// </summary>
 /// <param name="ClusterKey"></param>
 public override void Sort(IRecordMatcher SortKey)
 {
     throw new ArgumentException("Cannot sort a sorted page; it's already sorted and the key cannot be changed");
 }
Esempio n. 7
0
 public SortedPage(Page Primitive, IRecordMatcher Matcher)
     : this(Primitive.PageSize, Primitive.PageID, Primitive.LastPageID, Primitive.NextPageID, Primitive.FieldCount, Primitive.UsedSpace, Matcher)
 {
     this._Elements = Primitive.Cache;
 }
Esempio n. 8
0
 public SortedPage(int PageSize, int PageID, int LastPageID, int NextPageID, int FieldCount, int UsedSpace, IRecordMatcher Matcher)
     : base(PageSize, PageID, LastPageID, NextPageID, FieldCount, UsedSpace)
 {
     this._Matcher = Matcher;
 }
 public HttpMockServer(IRecordMatcher matcher)
 {
     instanceCount++;
     this.matcher = matcher;
     this.Records = new Records(matcher);
     
     if (Mode == HttpRecorderMode.Playback)
     {
         Records.EnqueueRange(sessionRecords);
     }
 }