コード例 #1
0
            public void Should_Copy_Multiple_Files_Absolute_Path()
            {
                const string filePath1 = "./src/a/a.txt";
                const string filePath2 = "./src/b/b.txt";
                const string dstPath   = "./dst";

                // Given
                var fixture = new FileCopierFixture();

                fixture.EnsureFileExists(filePath1);
                fixture.EnsureFileExists(filePath2);
                fixture.EnsureDirectoryExists(dstPath);

                // When
                FileCopier.CopyFiles(
                    fixture.Context,
                    new[]
                {
                    fixture.MakeAbsolute(filePath1),
                    fixture.MakeAbsolute(filePath2)
                },
                    new DirectoryPath(dstPath),
                    true);

                // Then
                Assert.True(fixture.ExistsFile($"{dstPath}/a/a.txt"));
                Assert.True(fixture.ExistsFile($"{dstPath}/b/b.txt"));
            }
コード例 #2
0
            public void Should_Copy_Single_File_Relative_Path()
            {
                const string filePath = "./src/a/a.txt";
                const string dstPath  = "./dst";

                // Given
                var fixture = new FileCopierFixture();

                fixture.EnsureFileExists(filePath);
                fixture.EnsureDirectoryExists(dstPath);

                // When
                FileCopier.CopyFiles(
                    fixture.Context,
                    new FilePath[]
                {
                    filePath
                },
                    new DirectoryPath(dstPath),
                    true);

                // Then
                Assert.True(fixture.ExistsFile($"{dstPath}/a/a.txt"));
            }