AppHarbor.Tests.GitRepositoryConfigurerTest.ShouldInitializeRepositoryIfUserWantIt C# (CSharp) Method

ShouldInitializeRepositoryIfUserWantIt() private method

private ShouldInitializeRepositoryIfUserWantIt ( [ fileSystem, [ reader, [ writer, [ gitCommand, GitRepositoryConfigurer repositoryConfigurer, string id, User user ) : void
fileSystem [
reader [
writer [
gitCommand [
repositoryConfigurer GitRepositoryConfigurer
id string
user AppHarbor.Model.User
return void
        public void ShouldInitializeRepositoryIfUserWantIt([Frozen]Mock<IFileSystem> fileSystem, [Frozen]Mock<TextReader> reader, [Frozen]Mock<TextWriter> writer, [Frozen]Mock<IGitCommand> gitCommand, GitRepositoryConfigurer repositoryConfigurer, string id, User user)
        {
            gitCommand.Setup(x => x.Execute("status")).Throws<GitCommandException>();
            reader.Setup(x => x.ReadLine()).Returns("y");
            var gitIgnoreFile = Path.Combine(Directory.GetCurrentDirectory(), ".gitignore");
            Action<MemoryStream> VerifyGitIgnoreContent = stream =>
                Assert.Equal(Encoding.Default.GetBytes(GitRepositoryConfigurer.DefaultGitIgnore), stream.ToArray());

            using (var stream = new DelegateOutputStream(VerifyGitIgnoreContent))
            {
                fileSystem.Setup(x => x.OpenWrite(gitIgnoreFile)).Returns(stream);
                repositoryConfigurer.Configure(id, user);
            }

            fileSystem.Verify(x => x.OpenWrite(gitIgnoreFile), Times.Once());
            gitCommand.Verify(x => x.Execute("init"), Times.Once());
            writer.Verify(x => x.WriteLine("Git repository was initialized with default .gitignore file."));
        }