public int Execute(TextWriter error, params string[] args) { ProxyGeneratorOptions generatorOptions = new ProxyGeneratorOptions(); if (Parser.ParseHelp(args)) { Parser.ParseArguments(args, generatorOptions); } else if (Parser.ParseArguments(args, generatorOptions) == false) { error.WriteLine(Parser.ArgumentsUsage(generatorOptions.GetType())); return(Error.InvalidArguments); } if (_proxyGenerator == null) { try { _proxyGenerator = CreateProxyGenerator(generatorOptions.Generator); } catch (Exception exc) { error.WriteLine(exc.Message); return(Error.CreateProxyGenerator); } } generatorOptions = _proxyGenerator.GetOptions(); if (generatorOptions == null) { error.WriteLine("{0}.GetOptions() returned null. Please use a different Generator.", _proxyGenerator.GetType().FullName); return(Error.InvalidGenerator); } if (Parser.ParseHelp(args)) { error.WriteLine(Parser.ArgumentsUsage(generatorOptions.GetType())); return(Error.None); } if (Parser.ParseArguments(args, generatorOptions) == false) { error.WriteLine(Parser.ArgumentsUsage(generatorOptions.GetType())); return(Error.InvalidArguments); } try { _proxyGenerator.Generate(generatorOptions); } catch (Exception exc) { error.WriteLine(exc.Message); error.WriteLine(exc.StackTrace); return(Error.Unknown); } return(Error.None); }
public void SetUp() { _error = new StringWriter(); _mocks = new MockRepository(); _generator = _mocks.DynamicMock<IProxyGenerator>(); SetupResult.For(_generator.GetOptions()) .Return(new ProxyGeneratorOptions()); _program = new Program(); _program.ProxyGenerator = _generator; }
public void SetUp() { _error = new StringWriter(); _mocks = new MockRepository(); _generator = _mocks.DynamicMock <IProxyGenerator>(); SetupResult.For(_generator.GetOptions()) .Return(new ProxyGeneratorOptions()); _program = new Program(); _program.ProxyGenerator = _generator; }