Exemplo n.º 1
0
 public void VsSolutionTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     IVsSolution actual = target.solution;
     Assert.IsNotNull(actual, "Cnstructor did not get the solution class.");
 }
Exemplo n.º 2
0
 public void VsOnQueryUnloadProjectTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     IVsHierarchy pRealHierarchy = null; // TODO: Initialize to an appropriate value
     int pfCancel = 0; // TODO: Initialize to an appropriate value
     int pfCancelExpected = 0; // TODO: Initialize to an appropriate value
     int expected = VSConstants.E_NOTIMPL;
     int actual;
     actual = target.OnQueryUnloadProject(pRealHierarchy, ref pfCancel);
     Assert.AreEqual(pfCancelExpected, pfCancel);
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 3
0
        public void VsOnAfterOpenSolutionTest()
        {
            IServiceProvider          serviceProvider = this.PrepareServiceProvider();
            SolutionListener_Accessor target          = new SolutionListener_Accessor(serviceProvider);

            bool eventFired = false;

            target.AfterSolutionOpened += (sender, args) => { eventFired = true; };
            int expected = VSConstants.S_OK;
            int actual   = target.OnAfterOpenSolution(null, 0);

            Assert.AreEqual(expected, actual);
            Assert.IsTrue(eventFired, "Event was not fired");
        }
Exemplo n.º 4
0
        public void VsOnQueryCloseSolutionTest()
        {
            IServiceProvider          serviceProvider = this.PrepareServiceProvider();
            SolutionListener_Accessor target          = new SolutionListener_Accessor(serviceProvider);
            object pUnkReserved     = null; // TODO: Initialize to an appropriate value
            int    pfCancel         = 0;    // TODO: Initialize to an appropriate value
            int    pfCancelExpected = 0;    // TODO: Initialize to an appropriate value
            int    expected         = VSConstants.E_NOTIMPL;
            int    actual;

            actual = target.OnQueryCloseSolution(pUnkReserved, ref pfCancel);
            Assert.AreEqual(pfCancelExpected, pfCancel);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        public void OnQueryUnloadProjectTest()
        {
            IServiceProvider          serviceProvider = this.PrepareServiceProvider();
            SolutionListener_Accessor target          = new SolutionListener_Accessor(serviceProvider);
            IVsHierarchy pRealHierarchy   = null; // TODO: Initialize to an appropriate value
            int          pfCancel         = 0;    // TODO: Initialize to an appropriate value
            int          pfCancelExpected = 0;    // TODO: Initialize to an appropriate value
            int          expected         = VSConstants.E_NOTIMPL;
            int          actual;

            actual = target.OnQueryUnloadProject(pRealHierarchy, ref pfCancel);
            Assert.AreEqual(pfCancelExpected, pfCancel);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void EventsCookieTest()
        {
            var serviceProvider = new MockServiceProvider();
            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
            uint expected = 0;

            uint actual = target.eventsCookie;
            Assert.AreEqual(expected, actual, "initial value should be zero");

            target.Initialize();

            actual = target.eventsCookie;
            Assert.IsTrue(expected < actual, "Value after initialize should not be zero.");
        }
Exemplo n.º 7
0
        public void VsEventsCookieTest()
        {
            var serviceProvider = new MockServiceProvider();
            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
            uint expected = 0;

            uint actual = target.eventsCookie;

            Assert.AreEqual(expected, actual, "initial value should be zero");

            target.Initialize();

            actual = target.eventsCookie;
            Assert.IsTrue(expected < actual, "Value after initialize should not be zero.");
        }
Exemplo n.º 8
0
        public void VsOnBeforeCloseSolutionTest()
        {
            var serviceProvider = new MockServiceProvider();

            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);

            bool eventFired = false;

            target.BeforeClosingSolution += (sender, args) => { eventFired = true; };
            int expected = VSConstants.S_OK;
            int actual   = target.OnBeforeCloseSolution(null);

            Assert.AreEqual(expected, actual);
            Assert.IsTrue(eventFired, "Event was not fired");
        }
Exemplo n.º 9
0
        public void DisposeTest()
        {
            var serviceProvider = new MockServiceProvider();
            var mockSolutionEvents = new Mock<IVsSolutionEvents>();

            uint cookie = 0;
            ((IVsSolution)serviceProvider.GetService(typeof(SVsSolution))).AdviseSolutionEvents(mockSolutionEvents.Instance as IVsSolutionEvents, out cookie);
            Debug.Assert(cookie == 1);

            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
            target.eventsCookie = cookie;
            target.Dispose();

            uint expected = 0;
            Assert.AreEqual(expected, target.eventsCookie, "Dispose does not remove the event sink");
        }
Exemplo n.º 10
0
        public void VsDisposeTest()
        {
            var serviceProvider    = new MockServiceProvider();
            var mockSolutionEvents = new Mock <IVsSolutionEvents>();

            uint cookie = 0;

            ((IVsSolution)serviceProvider.GetService(typeof(SVsSolution))).AdviseSolutionEvents(mockSolutionEvents.Instance as IVsSolutionEvents, out cookie);
            Debug.Assert(cookie == 1);

            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);

            target.eventsCookie = cookie;
            target.Dispose();

            uint expected = 0;

            Assert.AreEqual(expected, target.eventsCookie, "Dispose does not remove the event sink");
        }
Exemplo n.º 11
0
 public void SolutionListenerConstructorTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     Assert.IsNotNull(target);
 }
Exemplo n.º 12
0
 public void OnQueryCloseSolutionTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     object pUnkReserved = null; // TODO: Initialize to an appropriate value
     int pfCancel = 0; // TODO: Initialize to an appropriate value
     int pfCancelExpected = 0; // TODO: Initialize to an appropriate value
     int expected = VSConstants.E_NOTIMPL;
     int actual;
     actual = target.OnQueryCloseSolution(pUnkReserved, ref pfCancel);
     Assert.AreEqual(pfCancelExpected, pfCancel);
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 13
0
 public void OnBeforeOpeningChildrenTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     IVsHierarchy hierarchy = null; // TODO: Initialize to an appropriate value
     int expected = VSConstants.E_NOTIMPL;
     int actual;
     actual = target.OnBeforeOpeningChildren(hierarchy);
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 14
0
        public void OnBeforeCloseSolutionTest()
        {
            var serviceProvider = new MockServiceProvider();

            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);

            bool eventFired = false;
            target.BeforeClosingSolution += (sender, args) => { eventFired = true; };
            int expected = VSConstants.S_OK;
            int actual = target.OnBeforeCloseSolution(null);
            Assert.AreEqual(expected, actual);
            Assert.IsTrue(eventFired, "Event was not fired");
        }
Exemplo n.º 15
0
        public void OnAfterOpenSolutionTest()
        {
            IServiceProvider serviceProvider = this.PrepareServiceProvider();
            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);

            bool eventFired = false;
            target.AfterSolutionOpened += (sender, args) => { eventFired = true; };
            int expected = VSConstants.S_OK;
            int actual = target.OnAfterOpenSolution(null, 0);
            Assert.AreEqual(expected, actual);
            Assert.IsTrue(eventFired, "Event was not fired");
        }
Exemplo n.º 16
0
 public void OnAfterLoadProjectTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     IVsHierarchy pStubHierarchy = null; // TODO: Initialize to an appropriate value
     IVsHierarchy pRealHierarchy = null; // TODO: Initialize to an appropriate value
     int expected = VSConstants.E_NOTIMPL;
     int actual;
     actual = target.OnAfterLoadProject(pStubHierarchy, pRealHierarchy);
     Assert.AreEqual(expected, actual);
 }
Exemplo n.º 17
0
        public void InitializeTest()
        {
            var serviceProvider = new MockServiceProvider();
            SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
            uint expected = 0;
            Assert.AreEqual(expected, target.eventsCookie);

            expected = 1;
            target.eventsCookie = expected;
            target.Initialize();
            Assert.AreEqual(expected, target.eventsCookie);
        }
Exemplo n.º 18
0
 public void VsOnAfterAsynchOpenProjectTest()
 {
     IServiceProvider serviceProvider = this.PrepareServiceProvider();
     SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider);
     IVsHierarchy hierarchy = null; // TODO: Initialize to an appropriate value
     int fAdded = 0; // TODO: Initialize to an appropriate value
     int expected = VSConstants.E_NOTIMPL;
     int actual;
     actual = target.OnAfterAsynchOpenProject(hierarchy, fAdded);
     Assert.AreEqual(expected, actual);
 }