private string GetStubInterfaceName(IExpectedTypeConstraint typeConstraint) { var languageType = _anchor.Language; var firstInterfaceType = typeConstraint.GetDefaultTypes().First(); return(firstInterfaceType.GetPresentableName(languageType)); }
private IDeclarationStatement CreateStubDeclaration(CSharpElementFactory factory, IExpectedTypeConstraint typeConstraint) { return (IDeclarationStatement)factory.CreateStatement( "var $0 = MockRepository.GenerateStub<$1>();", _referenceName, GetStubInterfaceName(typeConstraint)); }
private string GetStubInterfaceName(IExpectedTypeConstraint typeConstraint) { var languageType = _anchor.Language; var firstInterfaceType = typeConstraint.GetDefaultTypes().First(); return firstInterfaceType.GetPresentableName(languageType); }
private IDeclarationStatement GetDeclarationStatement(IList<ICSharpExpression> usages, IExpectedTypeConstraint typeConstraint) { try { var factory = CSharpElementFactory.GetInstance(_referenceExpression.GetPsiModule()); var statement = CreateStubDeclaration(factory, typeConstraint); var insertLocation = CSharpExpressionUtil.GetStatementToBeVisibleFromAll(usages); return StatementUtil.InsertStatement(statement, ref insertLocation, true); } catch (Exception ex) { File.AppendAllText("c:\\temp\\MillimanPluginErrors.txt", "Exception on " + DateTime.Now + "\n" + ex + "\n\n"); throw; } }
private IDeclarationStatement GetDeclarationStatement(IList <ICSharpExpression> usages, IExpectedTypeConstraint typeConstraint) { try { var factory = CSharpElementFactory.GetInstance(_referenceExpression.GetPsiModule()); var statement = CreateStubDeclaration(factory, typeConstraint); var insertLocation = CSharpExpressionUtil.GetStatementToBeVisibleFromAll(usages); return(StatementUtil.InsertStatement(statement, ref insertLocation, true)); } catch (Exception ex) { File.AppendAllText("c:\\temp\\MillimanPluginErrors.txt", "Exception on " + DateTime.Now + "\n" + ex + "\n\n"); throw; } }
private IDeclarationStatement CreateStubDeclaration(CSharpElementFactory factory, IExpectedTypeConstraint typeConstraint) { return((IDeclarationStatement)factory.CreateStatement( "var $0 = MockRepository.GenerateStub<$1>();", _referenceName, GetStubInterfaceName(typeConstraint))); }