Esempio n. 1
0
        public void CanRobocopy()
        {
            var executableDirectory = DirectoryHelper.ExecutingDirectory();

            var outputDirectory = Path.Combine(executableDirectory.FullName, "Robo");

            var tasks = TaskHelper.Start()
            .AddTask("Initialize directories", (ctx, arg) => {
                var tempDir1 = new TempDirectory(outputDirectory, ctx.ProjectName);
                var tempDir2 = new TempDirectory(outputDirectory, ctx.ProjectName);

                File.AppendAllText(Path.Combine(tempDir1.DirectoryPath, "testfile.txt"), "test data");

                ctx.RegisterCleanup(() => { tempDir1.Dispose(); tempDir2.Dispose(); });

                return new RobocopyArgs(tempDir1.DirectoryPath, tempDir2.DirectoryPath);
            })
            .Robocopy()
            .AddStep((ctx, arg) => {
                var exists = File.Exists(Path.Combine(arg.CopiedToDirectory, "testfile.txt"));
                Assert.IsTrue(exists);
                return exists;
            })
            .Finalize();

            var command = new KissCommand("build", tasks);

            var project = new KissProject("TestProject", "UI", command);

            using (var projectService = TestHelper.GetService())
            {
                projectService.RegisterProject(project);
                ProjectHelper.Run(project, command, projectService);
            }
        }