Esempio n. 1
0
        public async Task Build_will_build_every_project_for_given_framework()
        {
            var backend  = SampleProjects.Backend;
            var frontend = SampleProjects.Frontend;
            var projects = new[] { backend, frontend };

            var options = TestOptions.Create();

            var backendDirectoryPaths = backend.GetAppDirectoryPaths(_fileSystem);
            var backendBuildProccess  = new AppProcess(new Process(), AppTask.Build, AppStatus.Success);

            _dotnetServiceMock.Setup(m => m.Build(backend, backendDirectoryPaths[0], options, It.IsAny <CancellationToken>()))
            .ReturnsAsync(backendBuildProccess)
            .Verifiable();

            var frontendDirectoryPaths = frontend.GetAppDirectoryPaths(_fileSystem);
            var frontendBuildProcess   = new AppProcess(new Process(), AppTask.Build, AppStatus.Success);

            _nodeServiceMock.Setup(m => m.Build(frontend, frontendDirectoryPaths[0], options, It.IsAny <CancellationToken>()))
            .ReturnsAsync(frontendBuildProcess)
            .Verifiable();

            var output = await _runnerService.BuildAsync(projects, options, CancellationToken.None);

            Assert.Same(backend, output[0]);
            Assert.Same(backendBuildProccess, output[0].Processes.First());

            Assert.Same(frontend, output[1]);
            Assert.Same(frontendBuildProcess, output[1].Processes.First());

            _dotnetServiceMock.Verify();
            _nodeServiceMock.Verify();
        }
Esempio n. 2
0
        protected override async Task <int> ExecuteAsync(IList <Project> projects, CancellationToken cancellationToken)
        {
            await _runnerService.BuildAsync(projects, Options, cancellationToken);

            return(0);
        }