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."); }
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); }
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"); }
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); }
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); }
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."); }
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."); }
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"); }
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"); }
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"); }
public void SolutionListenerConstructorTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); SolutionListener_Accessor target = new SolutionListener_Accessor(serviceProvider); Assert.IsNotNull(target); }
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); }
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); }
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"); }
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"); }
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); }
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); }
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); }