public void ItCreatesTheSentinelInTheDotnetUserProfileFolderPathIfItDoesNotExistAlready() { var fileSystemMock = _fileSystemMockBuilder.Build(); var firstTimeUseNoticeSentinel = new FirstTimeUseNoticeSentinel( DOTNET_USER_PROFILE_FOLDER_PATH, fileSystemMock); firstTimeUseNoticeSentinel.Exists().Should().BeFalse(); firstTimeUseNoticeSentinel.CreateIfNotExists(); firstTimeUseNoticeSentinel.Exists().Should().BeTrue(); }
public void ItCreatesTheDotnetUserProfileFolderIfItDoesNotExistAlreadyWhenCreatingTheSentinel() { var fileSystemMock = _fileSystemMockBuilder.Build(); var directoryMock = new DirectoryMock(); var firstTimeUseNoticeSentinel = new FirstTimeUseNoticeSentinel( DOTNET_USER_PROFILE_FOLDER_PATH, fileSystemMock.File, directoryMock); firstTimeUseNoticeSentinel.CreateIfNotExists(); directoryMock.Exists(DOTNET_USER_PROFILE_FOLDER_PATH).Should().BeTrue(); directoryMock.CreateDirectoryInvoked.Should().BeTrue(); }
public void ItDoesNotAttemptToCreateTheDotnetUserProfileFolderIfItAlreadyExistsWhenCreatingTheSentinel() { var fileSystemMock = _fileSystemMockBuilder.Build(); var directoryMock = new DirectoryMock(new List <string> { DOTNET_USER_PROFILE_FOLDER_PATH }); var firstTimeUseNoticeSentinel = new FirstTimeUseNoticeSentinel( DOTNET_USER_PROFILE_FOLDER_PATH, fileSystemMock.File, directoryMock); firstTimeUseNoticeSentinel.CreateIfNotExists(); directoryMock.CreateDirectoryInvoked.Should().BeFalse(); }
public void ItDoesNotCreateTheSentinelAgainIfItAlreadyExistsInTheDotnetUserProfileFolderPath() { const string contentToValidateSentinelWasNotReplaced = "some string"; var sentinel = Path.Combine(DOTNET_USER_PROFILE_FOLDER_PATH, FirstTimeUseNoticeSentinel.SENTINEL); _fileSystemMockBuilder.AddFile(sentinel, contentToValidateSentinelWasNotReplaced); var fileSystemMock = _fileSystemMockBuilder.Build(); var firstTimeUseNoticeSentinel = new FirstTimeUseNoticeSentinel( DOTNET_USER_PROFILE_FOLDER_PATH, fileSystemMock); firstTimeUseNoticeSentinel.Exists().Should().BeTrue(); firstTimeUseNoticeSentinel.CreateIfNotExists(); fileSystemMock.File.ReadAllText(sentinel).Should().Be(contentToValidateSentinelWasNotReplaced); }