public void ShouldProcessRequestForAliasSteps()
        {
            var mockAttributesLoader = new Mock <IAttributesLoader>();

            mockAttributesLoader.Setup(x => x.GetRemovedAttributes()).Returns(new List <XAttribute>());
            var          loader  = new StaticLoader(mockAttributesLoader.Object);
            const string content = "using Gauge.CSharp.Lib.Attributes;\n" +
                                   "namespace foobar\n" +
                                   "{\n" +
                                   "    public class FooBar\n" +
                                   "    {\n" +
                                   "        [Step(\"goodbye\",\"sayonara\")]\n" +
                                   "        public void farewell()\n" +
                                   "        {\n" +
                                   "        }\n" +
                                   "    }\n" +
                                   "}\n";
            const string file = "Foo.cs";

            loader.LoadStepsFromText(content, file);

            var processor = new StepPositionsProcessor(loader.GetStepRegistry());
            var request   = new Message {
                StepPositionsRequest = new StepPositionsRequest {
                    FilePath = "Foo.cs"
                }
            };

            var response = processor.Process(request).StepPositionsResponse;

            Assert.AreEqual(response.StepPositions.Count, 2);
        }
        public void ShouldProcessRequestForAliasSteps()
        {
            var filePath         = "Foo.cs";
            var mockStepRegistry = new Mock <IStepRegistry>();

            mockStepRegistry.Setup(x => x.GetStepPositions(filePath))
            .Returns(new[] {
                new StepPosition {
                    StepValue = "goodbye", Span = new Span {
                        Start = 6, End = 16
                    }
                },
                new StepPosition {
                    StepValue = "Sayonara", Span = new Span {
                        Start = 6, End = 16
                    }
                },
            });
            var processor = new StepPositionsProcessor(mockStepRegistry.Object);
            var request   = new StepPositionsRequest {
                FilePath = filePath
            };

            var response = processor.Process(request);

            Assert.AreEqual(response.StepPositions.Count, 2);
        }
Exemplo n.º 3
0
        public void ShouldProcessRequest()
        {
            var          loader  = new StaticLoader();
            const string content = "using Gauge.CSharp.Lib.Attributes;\n" +
                                   "namespace foobar\n" +
                                   "{\n" +
                                   "    public class FooBar\n" +
                                   "    {\n" +
                                   "        [Step(\"goodbye\")]\n" +
                                   "        public void farewell()\n" +
                                   "        {\n" +
                                   "        }\n" +
                                   "    }\n" +
                                   "}\n";
            const string file = "Foo.cs";

            loader.LoadStepsFromText(content, file);

            var processor = new StepPositionsProcessor(loader.GetStepRegistry());
            var request   = new Message {
                StepPositionsRequest = new StepPositionsRequest {
                    FilePath = "Foo.cs"
                }
            };

            var response = processor.Process(request).StepPositionsResponse;

            Assert.AreEqual(response.StepPositions.Count, 1);
            Assert.AreEqual(response.StepPositions.First().StepValue, "goodbye");
            Assert.AreEqual(response.StepPositions.First().Span.Start, 6);
        }
        public void ShouldProcessRequest()
        {
            var filePath         = "Foo.cs";
            var mockStepRegistry = new Mock <IStepRegistry>();

            mockStepRegistry.Setup(x => x.GetStepPositions(filePath))
            .Returns(new[] { new StepPosition {
                                 StepValue = "goodbye", Span = new Span {
                                     Start = 6, End = 16
                                 }
                             } });
            var processor = new StepPositionsProcessor(mockStepRegistry.Object);
            var request   = new StepPositionsRequest {
                FilePath = "Foo.cs"
            };

            var response = processor.Process(request);

            Assert.AreEqual(response.StepPositions.Count, 1);
            Assert.AreEqual(response.StepPositions.First().StepValue, "goodbye");
            Assert.AreEqual(response.StepPositions.First().Span.Start, 6);
        }