public void Initialize_AttachesEventSink() { // Arrange uint cookie; var buildManager = new Mock <IVsSolutionBuildManager>(MockBehavior.Strict); buildManager .Setup(b => b.AdviseUpdateSolutionEvents(It.IsAny <VsSolutionUpdatesProjectSnapshotChangeTrigger>(), out cookie)) .Returns(VSConstants.S_OK) .Verifiable(); var services = new Mock <IServiceProvider>(); services.Setup(s => s.GetService(It.Is <Type>(f => f == typeof(SVsSolutionBuildManager)))).Returns(buildManager.Object); var trigger = new VsSolutionUpdatesProjectSnapshotChangeTrigger(services.Object, Mock.Of <TextBufferProjectService>()); // Act trigger.Initialize(Mock.Of <ProjectSnapshotManagerBase>()); // Assert buildManager.Verify(); }