private DefaultProjectBuilder ProjectBuilderAfterBuildHasBegun(IVsSolutionBuildManager2 buildManager) { var project = Substitute.For <Project>(); var projectMapper = Substitute.For <IProjectMapper>(); var threading = Substitute.For <IVSThreadingService>(); var projectBuilder = new DefaultProjectBuilder(buildManager, threading, projectMapper); projectBuilder.BuildAsync(new List <Project> { project }); return(projectBuilder); }
public static void Build_BuildCompletedSuccessfully_TaskResultSetTrue() { var buildManager = BuildManagerWhichReturns(VSConstants.S_OK); var project = Substitute.For <Project>(); var mapper = Substitute.For <IProjectMapper>(); var projectBuilder = new DefaultProjectBuilder(buildManager, mapper); var buildTask = projectBuilder.BuildAsync(new List <Project> { project }); // Checking that we are subscribed to build events buildManager.ReceivedWithAnyArgs(1) .AdviseUpdateSolutionEvents(Arg.Any <IVsUpdateSolutionEvents>(), out var pdwCookie); }
public static async Task Build_VsFailsToStartBuild_TaskResultSetFalseAsync() { var buildManager = BuildManagerWhichReturns(VSConstants.S_FALSE); var project = Substitute.For <Project>(); var mapper = Substitute.For <IProjectMapper>(); var projectBuilder = new DefaultProjectBuilder(buildManager, mapper); var result = await projectBuilder.BuildAsync(new List <Project> { project }); Assert.False(result); // Checking that we are not listening to build events // if starting a build was not successful buildManager.DidNotReceiveWithAnyArgs() .AdviseUpdateSolutionEvents(null, out var pdwCookie); }