public void SkipsInstallation() { // Setup _fileSystemMock .Setup(x => x.DirectoryExists(It.IsAny <string>())) .Returns(true); var collection = CreateMockServiceCollection(); _task.ConfigureServices(collection); // Act using var provider = collection.BuildServiceProvider(); _task.InvokeExecute(provider).Should().BeTrue(); // Verify _commandFactoryMock .Verify( x => x.Create( It.Is <string>(dotnet => dotnet == _dotnetPath), It.Is <IEnumerable <string> >(args => args.Count() == _expectedArgs.Count() && args.All(y => _expectedArgs.Contains(y)))), Times.Never); _commandMock.Verify(x => x.Execute(), Times.Never); }
public void AreDependenciesRegistered() { var task = new InstallDotNetTool(); var collection = new ServiceCollection(); task.ConfigureServices(collection); var provider = collection.BuildServiceProvider(); DependencyInjectionValidation.IsDependencyResolutionCoherent( s => { task.ConfigureServices(s); }, out string message, additionalSingletonTypes: task.GetExecuteParameterTypes() ) .Should() .BeTrue(message); }