Пример #1
0
        /// <summary>
        /// Instanciates a millipede acceptor and wraps it around an existing underlying
        /// IAcceptor.
        /// </summary>
        /// <param name="underlyingAcceptor">The existing underlying IAcceptor</param>
        /// <param name="recorder">The Millipede Replayer/Recorder</param>
        protected MillipedeAcceptor(IAcceptor underlyingAcceptor, MillipedeRecorder recorder)
        {
            this.underlyingAcceptor = underlyingAcceptor;
            this.underlyingAcceptor.ValidateTransport += UnderlyingAcceptor_ValidateTransport;

            this.recorder = recorder;
            milliDescriptor = recorder.GenerateDescriptor(underlyingAcceptor);
            if (recorder.Mode != MillipedeMode.Playback)
            {
                // we only pass-through recorded connections in playback mode
                this.underlyingAcceptor.NewTransportAccepted += UnderlyingAcceptor_NewTransportEvent;
            }
        }
Пример #2
0
 /// <summary>
 /// Create a recording recorder that wraps around an existing underlying
 /// IConnector.
 /// </summary>
 /// <param name="underlyingConnector">The existing underlying IConnector</param>
 /// <param name="recorder">The Millipede Replayer/Recorder</param>
 protected MillipedeConnector(IConnector underlyingConnector, MillipedeRecorder recorder)
 {
     milliDescriptor = recorder.GenerateDescriptor(underlyingConnector);
     this.recorder = recorder;
     this.underlyingConnector = underlyingConnector;
 }
Пример #3
0
        public void BaseTestUniqueStableDescriptor()
        {
            string[] values = { typeof(String).FullName, "test", "bar", "test" };
            foreach (string value in values) {
                object d1 = recorder.GenerateDescriptor(value);
                recorder.Dispose();
                recorder = new MillipedeRecorder();
                object d2 = recorder.GenerateDescriptor(value);
                recorder.Dispose();
                Assert.AreEqual(d1,d2);
                recorder = new MillipedeRecorder();
            }

            Dictionary<object, object> descriptors = new Dictionary<object, object>();
            foreach (string value in values)
            {
                object d1 = recorder.GenerateDescriptor(value);
                Assert.IsFalse(descriptors.ContainsKey(d1));
                descriptors[d1] = d1;
            }
        }