public void CloseTest()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            EditorFactory editorFactory = new EditorFactory(package);
            Assert.AreEqual(VSConstants.S_OK, editorFactory.Close(), "Close did no return S_OK");
        }
        public void CheckLogicalView()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            //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));
        }
        public void CreateEditorInstance()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            //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));
        }
        public void SetSite()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

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

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

            // Site the editor factory
            Assert.AreEqual(0, editorFactory.SetSite(serviceProvider), "SetSite did not return S_OK");
        }
 public void IsIVsEditorFactory()
 {
     IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();
     EditorFactory editorFactory = new EditorFactory(package);
     Assert.IsNotNull(editorFactory as IVsEditorFactory, "The object does not implement IVsEditorFactory");
 }
        public void IsIDisposableTest()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            using (EditorFactory editorFactory = new EditorFactory(package))
            {
                Assert.IsNotNull(editorFactory as IDisposable, "The object does not implement IDisposable interface");
            }
        }
        public void DisposeTest()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            EditorFactory editorFactory = new EditorFactory(package);
            editorFactory.Dispose();
        }
        public void DisposeDisposableMembersTest()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            EditorFactory editorFactory = new EditorFactory(package);
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();
            editorFactory.SetSite(serviceProvider);
            object service = editorFactory.GetService(typeof(IProfferService));
            Assert.IsNotNull(service);
            editorFactory.Dispose(); //service provider contains no services after this call
            service = editorFactory.GetService(typeof(IProfferService));
            Assert.IsNull(service, "serviceprovider has not beed disposed as expected");
        }
        public void CreateInstance()
        {
            IronRacketVSPackagePackage package = new IronRacketVSPackagePackage();

            EditorFactory editorFactory = new EditorFactory(package);
            Assert.IsNotNull(editorFactory, "Failed to initialize new instance of EditorFactory.");
        }