Ejemplo n.º 1
0
		void CreateDocumentLoader()
		{
			document = MockRepository.GenerateStub<IRefactoringDocument>();
			documentView = MockRepository.GenerateStub<IRefactoringDocumentView>();
			documentView.Stub(view => view.RefactoringDocument).Return(document);
			documentLoader = MockRepository.GenerateStub<IDocumentLoader>();
		}
Ejemplo n.º 2
0
 void CreateDocumentLoader()
 {
     document     = MockRepository.GenerateStub <IRefactoringDocument>();
     documentView = MockRepository.GenerateStub <IRefactoringDocumentView>();
     documentView.Stub(view => view.RefactoringDocument).Return(document);
     documentLoader = MockRepository.GenerateStub <IDocumentLoader>();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The fully qualified type will not be added as the method's return value since
        /// NRefactory returns the incorrect start column for the method's region in this case.
        /// Instead we add the last part of the type so for "System.Object" we add "Object" so the
        /// method's region is correct. This only seems to affect methods where there is no modifier
        /// (e.g. public, private) explicitly defined in code.
        ///
        /// For MvcScaffolding we only need the start and end points to be correctly defined since the
        /// function will be immediately replaced with different code.
        /// </summary>
        public CodeFunction AddPublicMethod(string name, string type)
        {
            CodeGenerator            codeGenerator = GetCodeGenerator();
            IRefactoringDocumentView view          = LoadClassDocumentView();

            codeGenerator.InsertCodeAtEnd(Class.Region, view.RefactoringDocument, CreateMethod(name, type));
            return(GetMethodInserted(view));
        }
Ejemplo n.º 4
0
        public CodeVariable AddPublicVariable(string name, string type)
        {
            CodeGenerator            codeGenerator = GetCodeGenerator();
            IRefactoringDocumentView view          = LoadClassDocumentView();

            codeGenerator.InsertCodeAtEnd(Class.Region, view.RefactoringDocument, CreateField(name, type));
            return(GetVariableInserted(view));
        }
		public void Init()
		{
			helper = new ClassHelper();
			document = MockRepository.GenerateStub<IRefactoringDocument>();
			documentView = MockRepository.GenerateStub<IRefactoringDocumentView>();
			documentLoader = MockRepository.GenerateStub<IDocumentLoader>();
			fakeCodeGenerator = helper.CompilationUnitHelper.FakeCodeGenerator;
		}
 public void Init()
 {
     helper            = new ClassHelper();
     document          = MockRepository.GenerateStub <IRefactoringDocument>();
     documentView      = MockRepository.GenerateStub <IRefactoringDocumentView>();
     documentLoader    = MockRepository.GenerateStub <IDocumentLoader>();
     fakeCodeGenerator = helper.CompilationUnitHelper.FakeCodeGenerator;
 }
Ejemplo n.º 7
0
		void OpenDocument()
		{
			documentView = DocumentLoader.LoadRefactoringDocumentView(FilePosition.FileName);
			document = documentView.RefactoringDocument;
		}
Ejemplo n.º 8
0
 void OpenDocument()
 {
     documentView = DocumentLoader.LoadRefactoringDocumentView(FilePosition.FileName);
     document     = documentView.RefactoringDocument;
 }
Ejemplo n.º 9
0
        IClass FindMatchingClass(IRefactoringDocumentView view)
        {
            ICompilationUnit unit = view.Parse();

            return(FindMatchingClass(unit));
        }
Ejemplo n.º 10
0
 IField FindField(IRefactoringDocumentView view)
 {
     return(FindMatchingClass(view).Fields.Last());
 }
Ejemplo n.º 11
0
		IMethod FindMethod(IRefactoringDocumentView view)
		{
			return FindMatchingClass(view).Methods.Last();
		}
Ejemplo n.º 12
0
 IMethod FindMethod(IRefactoringDocumentView view)
 {
     return(FindMatchingClass(view).Methods.Last());
 }
Ejemplo n.º 13
0
        CodeFunction GetMethodInserted(IRefactoringDocumentView view)
        {
            IMethod method = FindMethod(view);

            return(new CodeFunction(method));
        }
Ejemplo n.º 14
0
		IClass FindMatchingClass(IRefactoringDocumentView view)
		{
			ICompilationUnit unit = view.Parse();
			return FindMatchingClass(unit);
		}
Ejemplo n.º 15
0
		IField FindField(IRefactoringDocumentView view)
		{
			return FindMatchingClass(view).Fields.Last();
		}
Ejemplo n.º 16
0
		CodeVariable GetVariableInserted(IRefactoringDocumentView view)
		{
			IField field = FindField(view);
			return new CodeVariable(field);
		}
Ejemplo n.º 17
0
        CodeVariable GetVariableInserted(IRefactoringDocumentView view)
        {
            IField field = FindField(view);

            return(new CodeVariable(field));
        }
Ejemplo n.º 18
0
		CodeFunction GetMethodInserted(IRefactoringDocumentView view)
		{
			IMethod method = FindMethod(view);
			return new CodeFunction(method);
		}