コード例 #1
0
ファイル: FileCopyTests.cs プロジェクト: zimmybln/Workflow
        public void CopySingleFileAsInput(string fileName)
        {
            var target = FromRootDirectory("Data\\Target");
            var source = FromRootDirectory($"Data\\Source\\{fileName}");

            var filecopy = new FileCopy()
            {
                TargetDirectory = new InArgument<string>(target)
            };

            var app = new WorkflowTestApplication(filecopy);

            app.Inputs.Add("SourceFiles", new List<string>(new[] {source}));

            app.Run();

            Assert.IsTrue(File.Exists(FromRootDirectory($"Data\\Target\\{fileName}")), "The expected file does not exists");
        }
コード例 #2
0
ファイル: FileCopyTests.cs プロジェクト: zimmybln/Workflow
        public void CopyFilesNotExists()
        {
            var target = FromRootDirectory("Data\\Target");
            var source = FromRootDirectory("Data\\Source\\SomeFileNotExists.txt");

            var filecopy = new FileCopy()
            {
                TargetDirectory = new InArgument<string>(target)
            };

            var app = new WorkflowTestApplication(filecopy);

            app.Inputs.Add("SourceFiles", new List<string>(new[] { source }));

            var result = app.Run();

            Assert.IsTrue(result.Exception != null && result.Exception.GetType() == typeof(FileNotFoundException), "exception FileNotFoundException wasn't thrown");
        }
コード例 #3
0
ファイル: FileInfoTests.cs プロジェクト: zimmybln/Workflow
        public void GetFileInfo()
        {
            var source = FromRootDirectory("Data\\Source\\SomeFile1.txt");

            var fileinfoactivity = new FileInfo()
            {
                FileName = source
            };

            var app = new WorkflowTestApplication(fileinfoactivity);

            var result = app.Run();

            var created = (DateTime)result["Created"];
            var length = (long)result["Length"];

            Assert.IsTrue(created < DateTime.Now, "created isn't past");
            Assert.IsTrue(length > 0, "length isn't a correct value");
        }
コード例 #4
0
ファイル: FileCopyTests.cs プロジェクト: zimmybln/Workflow
        public void CopySingleFileAsArgument(string fileName)
        {
            var target = FromRootDirectory("Data\\Target");
            var source = FromRootDirectory($"Data\\Source\\{fileName}");

            var filecopy = new FileCopy()
            {
                SourceFiles = new InArgument<List<string>>(context => new List<string>(new[] { source })),
                TargetDirectory = target
            };

            var app = new WorkflowTestApplication(filecopy);

            var result = app.Run();

            var expectedfilename = FromRootDirectory($"Data\\Target\\{fileName}");

            Assert.IsTrue((result["Result"] as List<string>)?.Contains(expectedfilename), "The expected file is not a part of the result");

            Assert.IsTrue(File.Exists(expectedfilename), "The expected file does not exists");
        }
コード例 #5
0
ファイル: MsBuildTests.cs プロジェクト: zimmybln/Workflow
        public void JustCompile(string fileName)
        {
            var project = FromRootDirectory($"Data\\Source\\{fileName}");
            var target = FromRootDirectory($"Data\\Target\\{MethodBase.GetCurrentMethod().Name}");

            ZipFile.ExtractToDirectory(project, target);

            var solution =
                FromRootDirectory(
                    $"Data\\Target\\{MethodBase.GetCurrentMethod().Name}\\{Path.GetFileNameWithoutExtension(fileName)}{".sln"}");

            var build = new MSBuild()
            {
                ProjectFile = solution
            };

            var app = new WorkflowTestApplication(build);

            var result = app.Run(_designerOptionsExtensions);

            Debug.WriteLine(result.Outputs["Result"]);

            Assert.IsTrue(result.Exception == null, "The execution an exception occured");
        }
コード例 #6
0
ファイル: FileCopyTests.cs プロジェクト: zimmybln/Workflow
        public void CopySingleFileAsVariable(string fileName)
        {
            var target = FromRootDirectory("Data\\Target");
            var source = FromRootDirectory($"Data\\Source\\{fileName}");

            var sourcevariable = new Variable<List<string>>()
            {
                Name = "Source"
            };

            var sequence = new Sequence()
            {
                Variables = { sourcevariable },
                Activities =
                {
                    new Assign<List<string>>()
                    {
                        To = OutArgument<List<string>>.FromVariable(sourcevariable),
                        Value = new InArgument<List<string>>(context => new List<string>(new[] {source}))
                    },
                    new FileCopy()
                    {
                        SourceFiles = new InArgument<List<string>>(sourcevariable),
                        TargetDirectory = new InArgument<string>(target)
                    }
                }
            };

            var app = new WorkflowTestApplication(sequence);

            app.Run();

            var expectedfilename = FromRootDirectory($"Data\\Target\\{fileName}");

            Assert.IsTrue(File.Exists(expectedfilename), "The expected file does not exists");
        }