コード例 #1
0
        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);
        }
コード例 #2
0
        public void SetStatus(string runnerId, SpecStatus specStatus, UInt64 time, IEnumerable <SpecStep> steps, IFileLocationParser fileLocationParser, IFileLocationMapper fileLocationMapper)
        {
            SpecStatusViewModel specStatusViewModel = null;

            if (!Statuses.TryGetValue(runnerId, out specStatusViewModel) || specStatusViewModel.Time <= time)
            {
                if (specStatusViewModel == null)
                {
                    specStatusViewModel = new SpecStatusViewModel()
                    {
                        Duration = 0
                    };
                    Statuses[runnerId] = specStatusViewModel;
                }
                else
                {
                    specStatusViewModel.Duration += (int)(time - specStatusViewModel.Time);
                }
                specStatusViewModel.Status = specStatus;
                specStatusViewModel.Time   = time;
                if (steps != null)
                {
                    specStatusViewModel.Steps = new BindableCollection <SpecStepViewModel>(steps.Select(s => SpecStepViewModel.Create(s, fileLocationParser, fileLocationMapper)));
                }
                UpdateDuration();
            }
        }