public void SetUpFixture()
        {
            resourceWriter  = new MockResourceWriter();
            resourceService = new MockResourceService();
            resourceService.SetResourceWriter(resourceWriter);

            AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor();
            document        = textEditor.Document;
            textEditor.Text = GetTextEditorCode();

            RubyParser       parser          = new RubyParser();
            ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.rb", document.Text);

            using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
                IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
                Form          form = (Form)host.RootComponent;
                form.ClientSize = new Size(499, 309);

                PropertyDescriptorCollection descriptors            = TypeDescriptor.GetProperties(form);
                PropertyDescriptor           namePropertyDescriptor = descriptors.Find("Name", false);
                namePropertyDescriptor.SetValue(form, "MainForm");

                DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
                using (serializationManager.CreateSession()) {
                    RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions());
                    generator.Merge(host, new AvalonEditDocumentAdapter(document, null), compilationUnit, serializationManager);
                }
            }
        }
        public void SetUpFixture()
        {
            generator = new MockDesignerGenerator();
            view      = new FormsDesignerViewContent(null, new MockOpenedFile("Test.rb"));
            generator.Attach(view);

            view.DesignerCodeFileContent = GetFormCode();
            loader = new DerivedRubyDesignerLoader(generator);

            // Begin load.
            mockDesignerLoaderHost = new MockDesignerLoaderHost();
            mockResourceService    = new MockResourceService();
            mockDesignerLoaderHost.AddService(typeof(IResourceService), mockResourceService);

            mockTypeResolutionService = mockDesignerLoaderHost.TypeResolutionService;

            mockExtenderProviderService = new MockExtenderProviderService();
            mockDesignerLoaderHost.AddService(typeof(IExtenderProviderService), mockExtenderProviderService);
            mockDesignerLoaderHost.AddService(typeof(ProjectResourceService), new ProjectResourceService(new MockProjectContent()));

            mockEventBindingService = new MockEventBindingService();
            mockDesignerLoaderHost.AddService(typeof(IEventBindingService), mockEventBindingService);

            serializationManager = new DesignerSerializationManager(mockDesignerLoaderHost);

            System.Console.WriteLine("Before BeginLoad");
            loader.BeginLoad(mockDesignerLoaderHost);
            System.Console.WriteLine("After BeginLoad");
            rootComponent = mockDesignerLoaderHost.RootComponent;

            designedForm      = new Form();
            designedForm.Name = "NewMainForm";
            mockDesignerLoaderHost.RootComponent = designedForm;
            loader.CallPerformFlush(serializationManager);
        }
Exemple #3
0
 void CreateResourceService()
 {
     fakeReader      = new MockResourceReader();
     fakeWriter      = new MockResourceWriter();
     resourceService = new MockResourceService();
     resourceService.SetResourceReader(fakeReader);
     resourceService.SetResourceWriter(fakeWriter);
 }
Exemple #4
0
 protected override void TestInitializeExtensions()
 {
     _mockGetRootResult = new MockGetRootResult {
         GetResultFunc = () => new List <MusicFolder>()
     };
     MockSubsonicService.GetMusicFolders = () => _mockGetRootResult;
     _mockResourceService    = new MockResourceService();
     Subject.ResourceService = _mockResourceService;
     _mockDialogService      = new MockDialogService();
     Subject.DialogService   = _mockDialogService;
 }
 public void Setup()
 {
     _mockWinRTWrapperService       = new MockWinRTWrappersService();
     _mockNavigationService         = new MockNavigationService();
     _mockDialogNotificationService = new MockDialogNotificationService();
     _mockResourceService           = new MockResourceService();
     _mockDialogService             = new MockDialogService();
     _subject = new ErrorDialogViewModel(
         _mockWinRTWrapperService,
         _mockNavigationService,
         _mockDialogNotificationService,
         _mockResourceService,
         _mockDialogService);
 }
Exemple #6
0
        public void Init()
        {
            dummyReader     = new MockResourceReader();
            dummyWriter     = new MockResourceWriter();
            resourceService = new MockResourceService();
            resourceService.SetResourceReader(dummyReader);
            resourceService.SetResourceWriter(dummyWriter);
            host = new MockDesignerLoaderHost();
            host.AddService(typeof(IResourceService), resourceService);
            loader = new PythonDesignerLoader(new MockDesignerGenerator());
            loader.BeginLoad(host);

            reader = loader.GetResourceReader(CultureInfo.InvariantCulture) as MockResourceReader;
            writer = loader.GetResourceWriter(CultureInfo.InvariantCulture) as MockResourceWriter;
        }