Exemple #1
0
        public void CheckLogicalView()
        {
            VisualStudioHaskellPackage package = new VisualStudioHaskellPackage();

            //Create the editor factory
            EditorFactory editorFactory = new EditorFactory(package);

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            serviceProvider.AddService(typeof(SLocalRegistry), (ILocalRegistry)LocalRegistryServiceMock.GetILocalRegistryInstance(), true);

            // Site the editor factory
            Assert.AreEqual(0, editorFactory.SetSite(serviceProvider), "SetSite did not return S_OK");

            IntPtr ppunkDocView;
            IntPtr ppunkDocData;
            string pbstrEditorCaption = String.Empty;
            Guid   pguidCmdUI         = Guid.Empty;
            int    pgrfCDW            = 0;

            Assert.AreEqual(VSConstants.S_OK, editorFactory.CreateEditorInstance(VSConstants.CEF_OPENFILE,
                                                                                 null, null, null, 0, IntPtr.Zero, out ppunkDocView, out ppunkDocData, out pbstrEditorCaption,
                                                                                 out pguidCmdUI, out pgrfCDW)); //check for successfull creation of editor instance

            string bstrPhysicalView   = string.Empty;
            Guid   refGuidLogicalView = VSConstants.LOGVIEWID_Debugging;

            Assert.AreEqual(VSConstants.E_NOTIMPL, editorFactory.MapLogicalView(ref refGuidLogicalView, out bstrPhysicalView));

            refGuidLogicalView = VSConstants.LOGVIEWID_Code;
            Assert.AreEqual(VSConstants.E_NOTIMPL, editorFactory.MapLogicalView(ref refGuidLogicalView, out bstrPhysicalView));

            refGuidLogicalView = VSConstants.LOGVIEWID_TextView;
            Assert.AreEqual(VSConstants.S_OK, editorFactory.MapLogicalView(ref refGuidLogicalView, out bstrPhysicalView));

            refGuidLogicalView = VSConstants.LOGVIEWID_UserChooseView;
            Assert.AreEqual(VSConstants.E_NOTIMPL, editorFactory.MapLogicalView(ref refGuidLogicalView, out bstrPhysicalView));

            refGuidLogicalView = VSConstants.LOGVIEWID_Primary;
            Assert.AreEqual(VSConstants.S_OK, editorFactory.MapLogicalView(ref refGuidLogicalView, out bstrPhysicalView));
        }
Exemple #2
0
        public void MapLogicalViewSupportedIdTest()
        {
            EditorFactory target = editorFactory;

            string pbstrPhysicalView = string.Empty;

            // specify a primary physical view
            Guid rguidLogicalView = VSConstants.LOGVIEWID_Primary;
            int  actual_result    = target.MapLogicalView(ref rguidLogicalView, out pbstrPhysicalView);

            Assert.IsNull(pbstrPhysicalView, "pbstrPhysicalView out parameter not initialized by null");
            Assert.AreEqual(VSConstants.S_OK, actual_result, "In case of supported view ID was expected S_OK result");
        }
Exemple #3
0
        public void MapLogicalViewNotSupportedIdTest()
        {
            EditorFactory target = editorFactory;

            string pbstrPhysicalView = string.Empty;

            // specify a not supported view ID
            Guid rguidLogicalView = VSConstants.LOGVIEWID_TextView;
            int  actual_result    = target.MapLogicalView(ref rguidLogicalView, out pbstrPhysicalView);

            Assert.IsNull(pbstrPhysicalView, "pbstrPhysicalView out parameter not initialized by null");
            Assert.AreEqual(VSConstants.E_NOTIMPL, actual_result, "In case of supported view ID was expected E_NOTIMPL result");
        }