示例#1
0
        private string GetStubInterfaceName(IExpectedTypeConstraint typeConstraint)
        {
            var languageType       = _anchor.Language;
            var firstInterfaceType = typeConstraint.GetDefaultTypes().First();

            return(firstInterfaceType.GetPresentableName(languageType));
        }
示例#2
0
 private IDeclarationStatement CreateStubDeclaration(CSharpElementFactory factory, IExpectedTypeConstraint typeConstraint)
 {
     return (IDeclarationStatement)factory.CreateStatement(
         "var $0 = MockRepository.GenerateStub<$1>();",
         _referenceName,
         GetStubInterfaceName(typeConstraint));
 }
示例#3
0
 private string GetStubInterfaceName(IExpectedTypeConstraint typeConstraint)
 {
     var languageType = _anchor.Language;
     var firstInterfaceType = typeConstraint.GetDefaultTypes().First();
     return firstInterfaceType.GetPresentableName(languageType);
 }
示例#4
0
 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;
     }
 }
示例#5
0
 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;
     }
 }
示例#6
0
 private IDeclarationStatement CreateStubDeclaration(CSharpElementFactory factory, IExpectedTypeConstraint typeConstraint)
 {
     return((IDeclarationStatement)factory.CreateStatement(
                "var $0 = MockRepository.GenerateStub<$1>();",
                _referenceName,
                GetStubInterfaceName(typeConstraint)));
 }