コード例 #1
0
        public void Visit(SetClassStep testStep)
        {
            var split         = testStep.QualifiedName.Split(new string[] { "," }, 2, StringSplitOptions.RemoveEmptyEntries);
            var fullClassName = split[0].Trim();
            var lastDotIndex  = fullClassName.LastIndexOf(".");

            if (lastDotIndex > 0)
            {
                this.nameSpace = fullClassName.Substring(0, lastDotIndex);
                this.className = fullClassName.Substring(lastDotIndex + 1);
            }
            else
            {
                this.className = fullClassName;
            }
        }
コード例 #2
0
        public TestStep Create(string command)
        {
            if (string.IsNullOrWhiteSpace(command))
            {
                return(null);
            }

            command = command.Trim();
            if (command.StartsWith("!loadAssembly"))
            {
                var step = new LoadAssemblyStep();
                step.AssemblyPath = ParseCommandParameter(command);
                return(step);
            }

            else if (command.StartsWith("!setClass"))
            {
                var step = new SetClassStep();
                step.QualifiedName = ParseCommandParameter(command);
                return(step);
            }

            else if (command.StartsWith("!testStep"))
            {
                var commandParameter = ParseCommandParameter(command);
                var step             = CreateExecuteMethodStep(commandParameter);
                return(step);
            }

            else if (command.StartsWith("#"))
            {
                var commandParameter = command.Substring(1);
                var step             = CreateExecuteMethodStep(commandParameter);
                return(step);
            }

            else
            {
                var step = new FormattingStep();
                step.FormattingText = command;
                return(step);
            }
        }