Inheritance: IBuildFolderPathProvider
        public void Constructor_AllParametersAreSet_ObjectIsInstantiated()
        {
            // Arrange
            var applicationInformation = new ApplicationInformation();
            IFilesystemAccessor filesystemAccessor = new Mock<IFilesystemAccessor>().Object;

            // Act
            var result = new BuildFolderPathProvider(applicationInformation, filesystemAccessor);

            // Arrange
            Assert.IsNotNull(result);
        }
        public void GetBuildFolderPath_DirectoryExistsIsCalled()
        {
            // Arrange
            bool directoryExistsGotCalled = false;

            var applicationInformation = ApplicationInformationProvider.GetApplicationInformation();

            var filesystemAccessorMock = new Mock<IFilesystemAccessor>();
            filesystemAccessorMock.Setup(f => f.DirectoryExists(applicationInformation.BuildFolder)).Returns(
                () =>
                    {
                        directoryExistsGotCalled = true;
                        return true;
                    });

            var buildFolderPathProvider = new BuildFolderPathProvider(applicationInformation, filesystemAccessorMock.Object);

            // Act
            buildFolderPathProvider.GetBuildFolderPath();

            // Assert
            Assert.IsTrue(directoryExistsGotCalled);
        }
        public void GetBuildFolderPath_FolderExists_FolderIsDeletedAndThenCreated()
        {
            // Arrange
            bool deleteDirectoryGotCalled = false;
            bool createDirectoryGotCalled = false;

            var applicationInformation = ApplicationInformationProvider.GetApplicationInformation();

            var filesystemAccessorMock = new Mock<IFilesystemAccessor>();
            filesystemAccessorMock.Setup(f => f.DirectoryExists(applicationInformation.BuildFolder)).Returns(true);
            filesystemAccessorMock.Setup(f => f.DeleteDirectory(applicationInformation.BuildFolder)).Returns(
                () =>
                {
                    deleteDirectoryGotCalled = true;
                    return true;
                });
            filesystemAccessorMock.Setup(f => f.CreateDirectory(applicationInformation.BuildFolder)).Returns(
                () =>
                {
                    createDirectoryGotCalled = true;
                    return true;
                });

            var buildFolderPathProvider = new BuildFolderPathProvider(applicationInformation, filesystemAccessorMock.Object);

            // Act
            buildFolderPathProvider.GetBuildFolderPath();

            // Assert
            Assert.IsTrue(deleteDirectoryGotCalled);
            Assert.IsTrue(createDirectoryGotCalled);
        }
        public void GetBuildFolderPath_ResultEqulsFolderSpecifiedByTheApplicationInformationPrePackagingFolderProperty()
        {
            // Arrange
            var applicationInformation = ApplicationInformationProvider.GetApplicationInformation();
            var filesystemAccessorMock = new Mock<IFilesystemAccessor>();
            filesystemAccessorMock.Setup(f => f.DirectoryExists(It.IsAny<string>())).Returns(true);

            var buildFolderPathProvider = new BuildFolderPathProvider(applicationInformation, filesystemAccessorMock.Object);

            // Act
            var result = buildFolderPathProvider.GetBuildFolderPath();

            // Assert
            Assert.AreEqual(applicationInformation.BuildFolder, result);
        }