public async Task Execute_With_NonExisting_Config_Asks_To_Create_It( bool solutionLoaded, string configPath, [Frozen] IFileAccessor fileAccessor, [Frozen][Substitute] IPopupManager popupManager, [Frozen][Substitute] ConfigFileProvider configFileProvider, Fixture fixture ) { // Arrange IoC.Container.Inject(popupManager); var sut = getSut(fixture, configFileProvider, fileAccessor, configPath, solutionLoaded); var called = false; // Act await sut.ExecuteAsync(s => { called = true; return(Task.CompletedTask); }); // Assert called.ShouldBeFalse(); popupManager.Received().Confirm(Arg.Any <string>(), Arg.Any <string>()); }
public async Task Response_To_Popup_Should_Open_File( bool solutionLoaded, string configPath, bool userWantsToCreateFile, [Frozen] IFileAccessor fileAccessor, [Frozen][Substitute] IPopupManager popupManager, [Frozen][Substitute] ConfigFileProvider configFileProvider, Fixture fixture ) { // Arrange popupManager.Configure().Confirm(Arg.Any <string>(), Arg.Any <string>()).Returns(userWantsToCreateFile); IoC.Container.Inject(popupManager); var sut = getSut(fixture, configFileProvider, fileAccessor, configPath, solutionLoaded); var called = false; // Act await sut.ExecuteAsync(s => { called = true; return(Task.CompletedTask); }); // Assert var expectedResult = userWantsToCreateFile; called.ShouldBe(expectedResult); popupManager.Received().Confirm(Arg.Any <string>(), Arg.Any <string>()); }