Exemple #1
0
        public void DescriptionTest()
        {
            SpecStatusViewModel specStatusViewModel = new SpecStatusViewModel()
            {
                Status   = SpecStatus.Passed,
                Time     = 10,
                Duration = 11
            };

            specStatusViewModel.Description.Replace("\r", "").Should().Be("Passed in 11 ms");

            specStatusViewModel.Steps = new BindableCollection <SpecStepViewModel>(new SpecStepViewModel[] {
                new SpecStepViewModel {
                    Message = "Step 1 message", Status = SpecStatus.Passed,
                    Trace   = new BindableCollection <SpecTraceStepViewModel>(new SpecTraceStepViewModel[] { SpecTraceStepViewModel.Create("Step 1 trace", null, null), SpecTraceStepViewModel.Create("Step 1 trace continued", null, null) })
                },
                new SpecStepViewModel {
                    Message = "Step 2 message", Status = SpecStatus.Failed,
                    Trace   = new BindableCollection <SpecTraceStepViewModel>(new SpecTraceStepViewModel[] { SpecTraceStepViewModel.Create("Step 2 trace", null, null) })
                }
            });

            specStatusViewModel.Description.Replace("\r", "").Should().Be("Passed in 11 ms\nStep 1 message Passed\nStep 1 trace\nStep 1 trace continued\nStep 2 message Failed\nStep 2 trace");

            specStatusViewModel = new SpecStatusViewModel
            {
                Status   = SpecStatus.Passed,
                Time     = 10,
                Duration = 11123
            };
            specStatusViewModel.Description.Should().Be("Passed in 11,123 s");
        }
 private IEnumerable <SpecStatusViewModel> GetRunnerStatuses(BindableCollection <RunnerViewModel> runners, BindableDictionary <string, SpecStatusViewModel> statuses)
 {
     foreach (RunnerViewModel runner in runners)
     {
         if (statuses.ContainsKey(runner.ConnectionId))
         {
             SpecStatusViewModel status = statuses[runner.ConnectionId];
             status.Runner = runner;
             yield return(status);
         }
         else
         {
             yield return(null);
         }
     }
 }
Exemple #3
0
        private SpecStatusViewModel CreateSpecStatusViewModel(SpecStatus specStatus, UInt64 time, int duration, SpecStep[] steps = null)
        {
            SpecStatusViewModel vm = new SpecStatusViewModel()
            {
                Status = specStatus, Time = time, Duration = duration
            };

            if (steps != null)
            {
                vm.Steps = new BindableCollection <SpecStepViewModel>(steps.Select(s => new SpecStepViewModel
                {
                    Message = s.Message,
                    Status  = s.Status,
                    Trace   = new BindableCollection <SpecTraceStepViewModel>(new SpecTraceStepViewModel[] { SpecTraceStepViewModel.Create(s.Trace, null, null) })
                }));
            }
            return(vm);
        }
Exemple #4
0
        public void DurationText()
        {
            SpecStatusViewModel specStatusViewModel = new SpecStatusViewModel()
            {
                Status   = SpecStatus.Passed,
                Time     = 10,
                Duration = 11
            };

            specStatusViewModel.DurationText.Should().Be("11 ms");

            specStatusViewModel = new SpecStatusViewModel
            {
                Status   = SpecStatus.Passed,
                Time     = 10,
                Duration = 11123
            };
            specStatusViewModel.DurationText.Should().Be("11,123 s");
        }
Exemple #5
0
            private void CheckSpec(Spec spec)
            {
                _Reporter.Suites.ShouldAllBeEquivalentTo(new Suite[] { spec.Suite.ParentSuite }, o => o.ExcludingMissingProperties());
                _Reporter.Suites.First().Suites.ShouldAllBeEquivalentTo(new Suite[] { spec.Suite }, o => o.ExcludingMissingProperties());
                _Reporter.Suites.First().Suites.First().Specs.Should().HaveCount(1);

                SpecViewModel reportersSpec = _Reporter.Suites.First().Suites.First().Specs.First();

                reportersSpec.ShouldBeEquivalentTo(spec, o => o.Excluding(si => si.PropertyPath == "Statuses" || si.PropertyPath == "Duration" || si.PropertyPath.EndsWith("IsNotifying")));
                reportersSpec.Statuses.Should().HaveCount(1);
                SpecStatusViewModel status = reportersSpec.Statuses.First().Value;

                status.Status.Should().Be(spec.Status);
                status.Description.Should().Contain(spec.Status.ToString());
                if (spec.Steps != null)
                {
                    foreach (SpecStep step in spec.Steps)
                    {
                        status.Description.Should().Contain(step.Message);
                        status.Description.Should().Contain(step.Status.ToString());
                        status.Description.Should().Contain(step.Trace);
                    }
                }
            }