コード例 #1
0
        public void ParseIncorrectJavascriptTrace(string message)
        {
            SpecTraceStepViewModel specTraceStepViewModel = SpecTraceStepViewModel.Create(message, Mock.Of <IFileLocationParser>(), Mock.Of <IFileLocationMapper>());

            specTraceStepViewModel.Message.Should().Be(message);
            specTraceStepViewModel.MethodName.Should().BeNull();
            specTraceStepViewModel.ScriptLocation.Should().BeNull();
        }
コード例 #2
0
        public void CreateWithMultilineTrace()
        {
            SpecStep specStep = new SpecStep
            {
                Trace = "Trace line 1\nTrace line 2"
            };

            SpecStepViewModel specStepViewModel = SpecStepViewModel.Create(specStep, Mock.Of <IFileLocationParser>(), null);

            specStepViewModel.Trace.ShouldAllBeEquivalentTo(new object[] {
                SpecTraceStepViewModel.Create("Trace line 1", null, null), SpecTraceStepViewModel.Create("Trace line 2", null, null)
            });
        }
コード例 #3
0
        public void CreateTest()
        {
            SpecStep specStep = new SpecStep
            {
                Message = "Message",
                Status  = SpecStatus.Failed,
                Trace   = "Trace"
            };

            SpecStepViewModel specStepViewModel = SpecStepViewModel.Create(specStep, Mock.Of <IFileLocationParser>(), Mock.Of <IFileLocationMapper>());

            specStepViewModel.ShouldBeEquivalentTo(specStep, o => o.Excluding(si => si.PropertyPath.EndsWith("IsNotifying") || si.PropertyPath == "Trace" || si.PropertyPath == "MappedLocation"));
            specStepViewModel.Trace.ShouldAllBeEquivalentTo(new object[] { SpecTraceStepViewModel.Create("Trace", null, null) });
        }
コード例 #4
0
        public void ParseIETrace(string message, string fileLocationText, string methodName, string filename, int lineNumber, int columnNumber)
        {
            FileLocation fileLocation = new FileLocation(filename, "", lineNumber, columnNumber);

            Mock <IFileLocationParser> fileLocationParserMock = new Mock <IFileLocationParser>();

            fileLocationParserMock.Setup(flf => flf.Parse(fileLocationText)).Returns(fileLocation);

            Mock <IFileLocationMapper> fileLocationMapperMock = new Mock <IFileLocationMapper>();

            fileLocationMapperMock.Setup(flm => flm.Map(fileLocation)).Returns <FileLocation>(fl => fl);

            SpecTraceStepViewModel specTraceStepViewModel = SpecTraceStepViewModel.Create(message, fileLocationParserMock.Object, fileLocationMapperMock.Object);

            specTraceStepViewModel.Message.Should().Be(message);
            specTraceStepViewModel.MethodName.Should().Be(methodName);
            specTraceStepViewModel.ScriptLocation.Filename.Should().Be(filename);
            specTraceStepViewModel.ScriptLocation.LineNumber.Should().Be(lineNumber);
            specTraceStepViewModel.ScriptLocation.ColumnNumber.Should().Be(columnNumber);
            specTraceStepViewModel.MappedLocation.Filename.Should().Be(filename);
            specTraceStepViewModel.MappedLocation.LineNumber.Should().Be(lineNumber);
            specTraceStepViewModel.MappedLocation.ColumnNumber.Should().Be(columnNumber);
        }
コード例 #5
0
        public void ParseJavascriptTraceWithoutMapping()
        {
            const string message    = @"jasmine.ExpectationResult@http://localhost:8080/Scripts/jasmine.js:114";
            const string filename   = @"/Scripts/jasmine.js";
            const int    lineNumber = 114;

            FileLocation fileLocation = new FileLocation(filename, "", lineNumber);

            Mock <IFileLocationParser> fileLocationParserMock = new Mock <IFileLocationParser>();

            fileLocationParserMock.Setup(flf => flf.Parse(@"http://*****:*****@"jasmine.ExpectationResult");
            specTraceStepViewModel.ScriptLocation.Filename.Should().Be(filename);
            specTraceStepViewModel.ScriptLocation.LineNumber.Should().Be(lineNumber);
            specTraceStepViewModel.MappedLocation.Should().BeNull();
        }
コード例 #6
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);
        }
コード例 #7
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");
        }