public void UpdateSolution_StartUpdateTest() { try { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int pfCancelUpdate = 0; int pfCancelUpdateExpected = 0; int expected = VSConstants.S_OK; int actual; bool eventFired = false; target.BeginBuild += (sender, args) => { eventFired = true; }; actual = target.UpdateSolution_StartUpdate(ref pfCancelUpdate); Assert.AreEqual(pfCancelUpdateExpected, pfCancelUpdate); Assert.AreEqual(expected, actual); Assert.IsTrue(eventFired, "The BeginBuild event did npot fire"); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
/// <summary> /// Disposes the contents of the class. /// </summary> /// <param name="disposing">Indicates whether to dispose unmanaged resources.</param> protected override void Dispose(bool disposing) { Param.Ignore(disposing); base.Dispose(disposing); if (disposing) { if (this.taskProvider != null) { this.taskProvider.Dispose(); this.taskProvider = null; } if (this.solutionListener != null) { this.solutionListener.Dispose(); this.solutionListener = null; } if (this.updateListener != null) { this.updateListener.Dispose(); this.updateListener = null; } } }
public void UpdateSolution_CancelTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int expected = VSConstants.E_NOTIMPL; int actual; actual = target.UpdateSolution_Cancel(); Assert.AreEqual(expected, actual); }
public void UpdateSolution_DoneTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int fSucceeded = 0; int fModified = 0; int fCancelCommand = 0; int expected = VSConstants.E_NOTIMPL; int actual = target.UpdateSolution_Done(fSucceeded, fModified, fCancelCommand); Assert.AreEqual(expected, actual); }
/// <summary> /// Register for the environment events. /// </summary> protected override void RegisterEnvironmentEvents() { this.updateListener = new UpdateSolutionListener(this.ServiceProvider); this.updateListener.BeginBuild += this.BuildEventsOnBuildBegin; this.updateListener.Initialize(); this.solutionListener = new SolutionListener(this.ServiceProvider); this.solutionListener.AfterSolutionOpened += this.SolutionOpenedEventHandler; this.solutionListener.BeforeClosingSolution += this.SolutionClosingEventHandler; this.solutionListener.Initialize(); }
public void UpdateSolution_StartUpdateTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int pfCancelUpdate = 0; int pfCancelUpdateExpected = 0; int expected = VSConstants.S_OK; int actual; bool eventFired = false; target.BeginBuild += (sender, args) => { eventFired = true; }; actual = target.UpdateSolution_StartUpdate(ref pfCancelUpdate); Assert.AreEqual(pfCancelUpdateExpected, pfCancelUpdate); Assert.AreEqual(expected, actual); Assert.IsTrue(eventFired, "The BeginBuild event did npot fire"); }
public void UpdateSolution_DoneTest() { try { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int fSucceeded = 0; int fModified = 0; int fCancelCommand = 0; int expected = VSConstants.E_NOTIMPL; int actual = target.UpdateSolution_Done(fSucceeded, fModified, fCancelCommand); Assert.AreEqual(expected, actual); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
public void UpdateSolution_BeginTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int pfCancelUpdate = 0; int pfCancelUpdateExpected = 0; int expected = VSConstants.E_NOTIMPL; int actual = target.UpdateSolution_Begin(ref pfCancelUpdate); Assert.AreEqual(pfCancelUpdateExpected, pfCancelUpdate); Assert.AreEqual(expected, actual); }
public void UpdateSolutionListenerConstructorTest() { try { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); Assert.IsNotNull(target); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
public void OnActiveProjectCfgChangeTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int expected = VSConstants.E_NOTIMPL; int actual = target.OnActiveProjectCfgChange(null); Assert.AreEqual(expected, actual); }
public void InitializeTest() { try { var serviceProvider = new MockServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); target.Initialize(); PrivateObject updateSolutionListener = new PrivateObject(target, new PrivateType(typeof(UpdateSolutionListener))); uint expected = 1; Assert.AreEqual(expected, updateSolutionListener.GetFieldOrProperty("eventsCookie")); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
public void DisposeTest() { try { var serviceProvider = new MockServiceProvider(); var mockUpdateSolutionEvents = new Mock<IVsUpdateSolutionEvents>(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); uint cookie = 0; ((IVsSolutionBuildManager)serviceProvider.GetService(typeof(SVsSolutionBuildManager))).AdviseUpdateSolutionEvents(mockUpdateSolutionEvents.Instance as IVsUpdateSolutionEvents, out cookie); Debug.Assert(cookie == 1); bool disposing = true; PrivateObject updateSolutionListner = new PrivateObject(target, new PrivateType(typeof(UpdateSolutionListener))); updateSolutionListner.SetFieldOrProperty("eventsCookie", cookie); updateSolutionListner.Invoke("Dispose", disposing); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
public void UpdateSolution_BeginTest() { try { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int pfCancelUpdate = 0; int pfCancelUpdateExpected = 0; int expected = VSConstants.E_NOTIMPL; int actual = target.UpdateSolution_Begin(ref pfCancelUpdate); Assert.AreEqual(pfCancelUpdateExpected, pfCancelUpdate); Assert.AreEqual(expected, actual); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
public void OnActiveProjectCfgChangeTest() { try { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); int expected = VSConstants.E_NOTIMPL; int actual = target.OnActiveProjectCfgChange(null); Assert.AreEqual(expected, actual); } catch (Exception ex) { // Use try catch to test a workaround on CI build (AppVeyor) Console.WriteLine(ex.Message); } }
public void DisposeTest() { var serviceProvider = new MockServiceProvider(); var mockUpdateSolutionEvents = new Mock<IVsUpdateSolutionEvents>(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); uint cookie = 0; ((IVsSolutionBuildManager)serviceProvider.GetService(typeof(SVsSolutionBuildManager))).AdviseUpdateSolutionEvents(mockUpdateSolutionEvents.Instance as IVsUpdateSolutionEvents, out cookie); Debug.Assert(cookie == 1); bool disposing = true; PrivateObject updateSolutionListner = new PrivateObject(target, new PrivateType(typeof(UpdateSolutionListener))); updateSolutionListner.SetFieldOrProperty("eventsCookie", cookie); updateSolutionListner.Invoke("Dispose", disposing); }
public void InitializeTest() { var serviceProvider = new MockServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); target.Initialize(); uint expected = 1; Assert.AreEqual(expected, expected, (uint)target.GetType() .GetField("eventsCookie", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(target)); }
public void DisposeTest() { var serviceProvider = new MockServiceProvider(); var mockUpdateSolutionEvents = new Mock<IVsUpdateSolutionEvents>(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); uint cookie = 0; ((IVsSolutionBuildManager)serviceProvider.GetService(typeof(SVsSolutionBuildManager))).AdviseUpdateSolutionEvents(mockUpdateSolutionEvents.Instance as IVsUpdateSolutionEvents, out cookie); Debug.Assert(cookie == 1); target.GetType() .GetField("eventsCookie", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(target, cookie); target.Dispose(); }
public void UpdateSolutionListenerConstructorTest() { IServiceProvider serviceProvider = this.PrepareServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); Assert.IsNotNull(target); }
public void InitializeTest() { var serviceProvider = new MockServiceProvider(); UpdateSolutionListener target = new UpdateSolutionListener(serviceProvider); target.Initialize(); PrivateObject updateSolutionListener = new PrivateObject(target, new PrivateType(typeof(UpdateSolutionListener))); uint expected = 1; Assert.AreEqual(expected, updateSolutionListener.GetFieldOrProperty("eventsCookie")); }