Exemple #1
0
        void SetUpWithCode(string code, int offset)
        {
            textEditor.Document.Text = code;
            textEditor.Caret.Offset  = offset;

            var      parseInfo = textEditor.CreateParseInformation();
            IProject project   = MockRepository.GenerateStrictMock <IProject>();
            var      pc        = new CSharpProjectContent().AddOrUpdateFiles(parseInfo.UnresolvedFile);

            pc = pc.AddAssemblyReferences(new[] { Corlib, PresentationCore, PresentationFramework, SystemXaml });
            var compilation = pc.CreateCompilation();

            SD.Services.AddService(typeof(IParserService), MockRepository.GenerateStrictMock <IParserService>());
            SD.ParserService.Stub(p => p.GetCachedParseInformation(textEditor.FileName)).Return(parseInfo);
            SD.ParserService.Stub(p => p.GetCompilation(project)).Return(compilation);
            SD.ParserService.Stub(p => p.GetCompilationForFile(textEditor.FileName)).Return(compilation);
            SD.ParserService.Stub(p => p.Parse(textEditor.FileName, textEditor.Document)).WhenCalled(
                i => {
                var p            = new XamlParser();
                p.TaskListTokens = TaskListTokens;
                i.ReturnValue    = p.Parse(textEditor.FileName, textEditor.Document, true, project, CancellationToken.None);
            }).Return(parseInfo);                     // fake Return to make it work
            SD.Services.AddService(typeof(IFileService), MockRepository.GenerateStrictMock <IFileService>());
            IViewContent view = MockRepository.GenerateStrictMock <IViewContent>();

            view.Stub(v => v.GetService(typeof(ITextEditor))).Return(textEditor);
            SD.FileService.Stub(f => f.OpenFile(textEditor.FileName, false)).Return(view);
        }
        void OpenFileInSharpDevelop(string fileName, bool dirty)
        {
            IViewContent view = MockRepository.GenerateStub <IViewContent>();

            view.Stub(v => v.IsDirty).Return(dirty);
            fakeFileService.AddOpenView(view, fileName);
        }
        public void SetUp()
        {
            SD.InitializeForUnitTests();
            textEditor = new MockTextEditor();
            textEditor.Document.Text = program;
            var parseInfo = textEditor.CreateParseInformation();

            this.project = MockRepository.GenerateStrictMock <IProject>();
            var pc = new CSharpProjectContent().AddOrUpdateFiles(parseInfo.UnresolvedFile);

            pc = pc.AddAssemblyReferences(new[] { Corlib });
            var compilation = pc.CreateCompilation();

            SD.Services.AddService(typeof(IParserService), MockRepository.GenerateStrictMock <IParserService>());

            SD.ParserService.Stub(p => p.GetCachedParseInformation(textEditor.FileName)).Return(parseInfo);
            SD.ParserService.Stub(p => p.GetCompilation(project)).Return(compilation);
            SD.ParserService.Stub(p => p.GetCompilationForFile(textEditor.FileName)).Return(compilation);
            SD.ParserService.Stub(p => p.Parse(textEditor.FileName, textEditor.Document)).WhenCalled(
                i => {
                var syntaxTree = new CSharpParser().Parse(textEditor.Document, textEditor.FileName);
                i.ReturnValue  = new CSharpFullParseInformation(syntaxTree.ToTypeSystem(), null, syntaxTree);
            }).Return(parseInfo);                     // fake Return to make it work
            SD.Services.AddService(typeof(IFileService), MockRepository.GenerateStrictMock <IFileService>());
            IViewContent view = MockRepository.GenerateStrictMock <IViewContent>();

            view.Stub(v => v.GetService(typeof(ITextEditor))).Return(textEditor);
            SD.FileService.Stub(f => f.OpenFile(textEditor.FileName, false)).Return(view);
            gen = new CSharpCodeGenerator();
        }
Exemple #4
0
		public void Init()
		{
			openedFile = MockRepository.GenerateStub<OpenedFile>();
			view = MockRepository.GenerateStub<IViewContent>();
			view.Stub(v => v.PrimaryFile).Return(openedFile);
		}
 public void Init()
 {
     openedFile = MockRepository.GenerateStub <OpenedFile>();
     view       = MockRepository.GenerateStub <IViewContent>();
     view.Stub(v => v.PrimaryFile).Return(openedFile);
 }