Пример #1
0
        /// <summary>
        /// Runs test with recording/replaying.
        /// </summary>
        /// <typeparam name="T">Test method return type.</typeparam>
        /// <param name="sut">Subject under test.</param>
        /// <param name="action">Action to be performed (typically test method)</param>
        /// <param name="done">Indicates that the test has finished.</param>
        /// <param name="openCycle">What should be called prior to <see cref="action"/>.</param>
        /// <param name="closeCycle">What should be called after <see cref="action"/>.</param>
        /// <param name="recorder">Instance of the recorder/player.</param>
        /// <param name="recordingFileName">Name of the recording file</param>
        /// <returns>Last result of the <see cref="action"/></returns>
        public static T Run <T>(this IVortexElement sut,
                                Func <T> action,
                                Func <bool> done,
                                Action openCycle         = null,
                                Action closeCycle        = null,
                                IRecorder recorder       = null,
                                string recordingFileName = null
                                )

        {
            T retVal = default(T);

            recorder?.Begin(recordingFileName);

            while (!done())
            {
                recorder?.Act();
                openCycle?.Invoke();
                retVal = action();
                closeCycle?.Invoke();
                recorder?.Act();
            }

            recorder?.Act();

            recorder?.End(recordingFileName);

            return(retVal);
        }
Пример #2
0
        /// <summary>
        /// Adds step to the this sequence.
        /// </summary>
        /// <returns>Newly added step.</returns>
        public Step AddStep(IVortexElement origin = null)
        {
            var newStep = new Step(origin);

            steps.Add(newStep);
            return(newStep);
        }
Пример #3
0
 public static LogInfo Create(IVortexElement obj)
 {
     return(new LogInfo()
     {
         AttributeName = obj.AttributeName,
         HumanReadable = obj.HumanReadable,
         Symbol = obj.Symbol,
         Payload = obj is IDecorateLog?AcquirePayload(((IDecorateLog)obj).LogPayloadDecoration) : null
     });
 }
Пример #4
0
 public void AddKid(IVortexElement kid)
 {
     _kids.Add(kid);
 }
Пример #5
0
 public static string NameOrSymbol(IVortexElement obj)
 {
     return(string.IsNullOrEmpty(obj.AttributeName) ? obj.GetSymbolTail() : obj.AttributeName);
 }
Пример #6
0
 public static string GetNameOrSymbol(this IVortexElement element)
 {
     return(string.IsNullOrEmpty(element.AttributeName) ? element.GetSymbolTail() : element.AttributeName);
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            IVortexElement val = value as IVortexElement;

            return(val != null?string.IsNullOrEmpty(val.AttributeName) ? val.GetSymbolTail() : val.AttributeName : "Missing object information");
        }
Пример #8
0
 public Step(IVortexElement origin)
 {
     Origin = origin;
 }