public void MethodNameReturnedWithoutParenthesis()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("MethodName()");

            Assert.Equal(1, entityNames.Length);
            Assert.Equal("MethodName", entityNames[0].Name);
        }
        public void MethodReturnedWithoutParametersWhenParameterIsStringWithParentheses()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("MethodName(\"(hello)\").Second()");

            Assert.Equal(2, entityNames.Length);
            Assert.Equal("MethodName", entityNames[0].Name);
            Assert.Equal("Second", entityNames[1].Name);
        }
        public void ImportAtStartOfLineAreIgnored()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("import MethodName().Property.Second()");

            Assert.Equal(3, entityNames.Length);
            Assert.Equal("MethodName", entityNames[0].Name);
            Assert.Equal("Property", entityNames[1].Name);
        }
        public void MixedMethodsAndPropertiesReturned()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("MethodName().Property.Second()");

            Assert.Equal(3, entityNames.Length);
            Assert.Equal("MethodName", entityNames[0].Name);
            Assert.Equal("Property", entityNames[1].Name);
            Assert.Equal("Second", entityNames[2].Name);
        }
        public void MethodReturnedWithoutParameters()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("instance.MethodName(aParameter).SecondMethod(anotherParameter, secondParameter)");

            Assert.Equal(3, entityNames.Length);
            Assert.Equal("instance", entityNames[0].Name);
            Assert.Equal("MethodName", entityNames[1].Name);
            Assert.Equal("SecondMethod", entityNames[2].Name);
        }
예제 #6
0
        private Invocation[] GetInvocationStack(string lineSource)
        {
            var lineParser = new LineEntityParser();

            if (lineSource.EndsWith("."))
                lineSource = lineSource.Substring(0, lineSource.Length - 1);

            return lineParser.GetEntityNames(lineSource);
        }
        public void NestedMethodsReturnedInOrder()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("instance.MethodName().SecondMethod().ThirdMethod()");

            Assert.Equal(4, entityNames.Length);
            Assert.Equal("instance", entityNames[0].Name);
            Assert.Equal("MethodName", entityNames[1].Name);
            Assert.Equal("SecondMethod", entityNames[2].Name);
            Assert.Equal("ThirdMethod", entityNames[3].Name);
        }
        public void VariableThenMethodReturned()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("instance.MethodName()");

            Assert.Equal(2, entityNames.Length);
            Assert.Equal("instance", entityNames[0].Name);
            Assert.Equal("MethodName", entityNames[1].Name);
        }
        public void SingleVariableReturned()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("instance");

            Assert.Equal(1, entityNames.Length);
            Assert.Equal("instance", entityNames[0].Name);
        }
        public void PropertiesReturned()
        {
            var lineParser = new LineEntityParser();
            var entityNames = lineParser.GetEntityNames("Property.SecondProperty.ThirdProperty");

            Assert.Equal(3, entityNames.Length);
            Assert.Equal("Property", entityNames[0].Name);
            Assert.Equal("SecondProperty", entityNames[1].Name);
            Assert.Equal("ThirdProperty", entityNames[2].Name);
        }