public static SpecStepViewModel Create(SpecStep specStep, IFileLocationParser fileLocationParser, IFileLocationMapper fileLocationMapper) { SpecStepViewModel specStepViewModel = new SpecStepViewModel { Message = specStep.Message, ErrorLocation = fileLocationParser.Parse(specStep.ErrorLocation), Status = specStep.Status, Trace = ParseTrace(specStep.Trace, fileLocationParser, fileLocationMapper) }; if (specStepViewModel.ErrorLocation != null) { specStepViewModel.MappedLocation = fileLocationMapper.Map(specStepViewModel.ErrorLocation); } return(specStepViewModel); }
public static SpecTraceStepViewModel Create(string traceLine, IFileLocationParser fileLocationParser, IFileLocationMapper fileLocationMapper) { string methodName = null; string scriptLocation = null; if (TryParseFirefoxSafari(traceLine, ref methodName, ref scriptLocation) || TryParseIEChrome(traceLine, ref methodName, ref scriptLocation)) { SpecTraceStepViewModel specTraceStepViewModel = new SpecTraceStepViewModel(); specTraceStepViewModel.Message = traceLine; specTraceStepViewModel.MethodName = String.IsNullOrEmpty(methodName) ? "<anonymous>" : methodName; specTraceStepViewModel.ScriptLocation = fileLocationParser.Parse(scriptLocation); specTraceStepViewModel.MappedLocation = fileLocationMapper.Map(specTraceStepViewModel.ScriptLocation); return(specTraceStepViewModel); } return(new SpecTraceStepViewModel() { Message = traceLine }); }