예제 #1
0
        public void CreateTest()
        {
            Guid specId = Guid.NewGuid();
            Spec spec   = new Spec()
            {
                Id     = specId,
                Name   = "Spec 1",
                Status = SpecStatus.Passed,
                Suite  = null,
                Time   = 100,
                Steps  = new SpecStep[]
                {
                    new SpecStep {
                        Message = "Step 1", Status = SpecStatus.Running, Trace = "Step 1 Trace line 1\nTrace line 2\nTrace line 3"
                    },
                    new SpecStep {
                        Message = "Step 2", Status = SpecStatus.Failed, Trace = "Step 2 Trace line 1\nTrace line 2\nTrace line 3"
                    },
                }
            };

            SpecViewModel.Create(spec).ShouldBeEquivalentTo(spec, o => o
                                                            .Excluding(si => si.PropertyPath.EndsWith("IsNotifying"))
                                                            .Excluding(si => si.PropertyPath == "Statuses")
                                                            .Excluding(si => si.PropertyPath == "Duration"));
        }
예제 #2
0
        private SpecViewModel GetSpecViewModel(string runnerId, Spec spec)
        {
            if (spec == null)
            {
                return(null);
            }

            SuiteViewModel suiteViewModel = GetSuiteViewModel(runnerId, spec.Suite, spec.Time);

            if (suiteViewModel == null)
            {
                return(null);
            }

            SpecViewModel specViewModel = suiteViewModel.Specs.FirstOrDefault(s => s.IsSpec(spec));

            if (specViewModel == null)
            {
                specViewModel = SpecViewModel.Create(spec);
                suiteViewModel.Specs.Add(specViewModel);
            }
            else
            {
                specViewModel.Time = spec.Time;
            }
            specViewModel.SetStatus(runnerId, spec.Status, spec.Time, spec.Steps, _FileLocationParser, _FileLocationMapper);
            return(specViewModel);
        }