Exemplo n.º 1
0
        public static void AssemblySetup(TestContext testContext)
        {
            TestScaffold = Scaffold <ISrcMLGlobalService> .Setup(new SrcMLServicePackage(), typeof(SSrcMLGlobalService));

            TestScaffoldCM = Scaffold <ICursorMonitorService> .Setup(new SrcMLServicePackage(), typeof(SCursorMonitorService));

            TestScaffoldMT = Scaffold <IMethodTrackService> .Setup(new SrcMLServicePackage(), typeof(SMethodTrackService));

            TestScaffoldData = Scaffold <ISrcMLDataService> .Setup(new SrcMLServicePackage(), typeof(SSrcMLDataService));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets up the visual studio host instance. This method sites the package in the <see cref="Microsoft.VSSDK.Tools.VsIdeTesting.VsIdeTestHostContext"/>
        /// and gets the service instance.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="serviceType"></param>
        /// <returns></returns>
        public static Scaffold <ISERVICE> Setup(IVsPackage package, Type serviceType)
        {
            Assert.IsNotNull(package, "Package is null");
            var scaffold = new Scaffold <ISERVICE>();

            scaffold.Package = package;

            var serviceProvider = VsIdeTestHostContext.Dte as IOleServiceProvider;

            Assert.IsNotNull(serviceProvider, "Could not get the service provider");

            // site the package
            Assert.AreEqual(VSConstants.S_OK, scaffold.Package.SetSite(serviceProvider), "Could not site the package");

            object serviceObject = VsIdeTestHostContext.ServiceProvider.GetService(serviceType);

            Assert.IsNotNull(serviceObject, String.Format("Could not get the service {0}", serviceType));
            Assert.IsInstanceOfType(serviceObject, typeof(ISERVICE), String.Format("Service object does not implement {0}", typeof(ISERVICE)));
            scaffold.Service = serviceObject as ISERVICE;

            return(scaffold);
        }
Exemplo n.º 3
0
 public static void AssemblySetup(TestContext testContext)
 {
     TestScaffold = Scaffold <ISrcMLGlobalService> .Setup(new SrcMLServicePackage(), typeof(SSrcMLGlobalService));
 }