Browse Source

First version

Piotr Czajkowski 4 years ago
parent
commit
f3a7437012

+ 9 - 0
CoreProcessFiles/CoreProcessFiles.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
+  </PropertyGroup>
+
+  <Import Project="..\ProcessFiles\ProcessFiles.projitems" Label="Shared" />
+
+</Project>

+ 22 - 0
CoreProcessFilesTests/CoreProcessFilesTests.csproj

@@ -0,0 +1,22 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
+
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
+    <PackageReference Include="xunit" Version="2.4.0" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
+    <PackageReference Include="coverlet.collector" Version="1.0.1" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\CoreProcessFiles\CoreProcessFiles.csproj" />
+  </ItemGroup>
+
+  <Import Project="..\ProcessFilesTests\ProcessFilesTests.projitems" Label="Shared" />
+
+</Project>

+ 48 - 0
NETProcessFiles/NETProcessFiles.csproj

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{30365F61-4D64-428F-8BE2-4F977E8A4FFC}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>NETProcessFiles</RootNamespace>
+    <AssemblyName>NETProcessFiles</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="..\ProcessFiles\ProcessFiles.projitems" Label="Shared" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 36 - 0
NETProcessFiles/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("NETProcessFiles")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NETProcessFiles")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("30365f61-4d64-428f-8be2-4f977e8a4ffc")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 85 - 0
NETProcessFilesTests/NETProcessFilesTests.csproj

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" />
+  <Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{BBAC076E-456E-4B83-B466-BEC83499F74E}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>NETProcessFilesTests</RootNamespace>
+    <AssemblyName>NETProcessFilesTests</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.assert, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.execution.desktop, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\NETProcessFiles\NETProcessFiles.csproj">
+      <Project>{30365f61-4d64-428f-8be2-4f977e8a4ffc}</Project>
+      <Name>NETProcessFiles</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
+  </ItemGroup>
+  <Import Project="..\ProcessFilesTests\ProcessFilesTests.projitems" Label="Shared" />
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.props'))" />
+    <Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" />
+    <Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.4.1\build\net20\xunit.runner.visualstudio.props'))" />
+  </Target>
+  <Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" />
+</Project>

+ 20 - 0
NETProcessFilesTests/Properties/AssemblyInfo.cs

@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("NETProcessFilesTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NETProcessFilesTests")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("bbac076e-456e-4b83-b466-bec83499f74e")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 11 - 0
NETProcessFilesTests/packages.config

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="xunit" version="2.4.1" targetFramework="net472" />
+  <package id="xunit.abstractions" version="2.0.3" targetFramework="net472" />
+  <package id="xunit.analyzers" version="0.10.0" targetFramework="net472" />
+  <package id="xunit.assert" version="2.4.1" targetFramework="net472" />
+  <package id="xunit.core" version="2.4.1" targetFramework="net472" />
+  <package id="xunit.extensibility.core" version="2.4.1" targetFramework="net472" />
+  <package id="xunit.extensibility.execution" version="2.4.1" targetFramework="net472" />
+  <package id="xunit.runner.visualstudio" version="2.4.1" targetFramework="net472" developmentDependency="true" />
+</packages>

+ 53 - 0
ProcessFiles.sln

@@ -0,0 +1,53 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ProcessFiles", "ProcessFiles\ProcessFiles.shproj", "{BEAA09EE-F7D8-458C-A457-1BD3C8428671}"
+EndProject
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ProcessFilesTests", "ProcessFilesTests\ProcessFilesTests.shproj", "{7A54C797-34E2-44DF-AFB5-2F0AF14DDC5F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NETProcessFiles", "NETProcessFiles\NETProcessFiles.csproj", "{30365F61-4D64-428F-8BE2-4F977E8A4FFC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NETProcessFilesTests", "NETProcessFilesTests\NETProcessFilesTests.csproj", "{BBAC076E-456E-4B83-B466-BEC83499F74E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreProcessFiles", "CoreProcessFiles\CoreProcessFiles.csproj", "{583801EF-7B5E-4D7C-B161-0AAA2CEDBA06}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreProcessFilesTests", "CoreProcessFilesTests\CoreProcessFilesTests.csproj", "{CCB1403B-D886-48C9-861B-F7A83C93EDC0}"
+EndProject
+Global
+	GlobalSection(SharedMSBuildProjectFiles) = preSolution
+		ProcessFiles\ProcessFiles.projitems*{30365f61-4d64-428f-8be2-4f977e8a4ffc}*SharedItemsImports = 4
+		ProcessFilesTests\ProcessFilesTests.projitems*{7a54c797-34e2-44df-afb5-2f0af14ddc5f}*SharedItemsImports = 13
+		ProcessFilesTests\ProcessFilesTests.projitems*{bbac076e-456e-4b83-b466-bec83499f74e}*SharedItemsImports = 4
+		ProcessFiles\ProcessFiles.projitems*{beaa09ee-f7d8-458c-a457-1bd3c8428671}*SharedItemsImports = 13
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{30365F61-4D64-428F-8BE2-4F977E8A4FFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{30365F61-4D64-428F-8BE2-4F977E8A4FFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{30365F61-4D64-428F-8BE2-4F977E8A4FFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{30365F61-4D64-428F-8BE2-4F977E8A4FFC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BBAC076E-456E-4B83-B466-BEC83499F74E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BBAC076E-456E-4B83-B466-BEC83499F74E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BBAC076E-456E-4B83-B466-BEC83499F74E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BBAC076E-456E-4B83-B466-BEC83499F74E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{583801EF-7B5E-4D7C-B161-0AAA2CEDBA06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{583801EF-7B5E-4D7C-B161-0AAA2CEDBA06}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{583801EF-7B5E-4D7C-B161-0AAA2CEDBA06}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{583801EF-7B5E-4D7C-B161-0AAA2CEDBA06}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CCB1403B-D886-48C9-861B-F7A83C93EDC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CCB1403B-D886-48C9-861B-F7A83C93EDC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CCB1403B-D886-48C9-861B-F7A83C93EDC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CCB1403B-D886-48C9-861B-F7A83C93EDC0}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {EF8B8C03-2C12-4161-9A35-52CBA387A234}
+	EndGlobalSection
+EndGlobal

+ 71 - 0
ProcessFiles/ProcessFiles.cs

@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace ProcessFiles
+{
+    public static class ProcessFiles
+    {
+        private static List<string> _errors;
+        private static void ProcessDir(string path, string fileExtension, Action<string> callback, bool recursive = false)
+        {
+            var searchOption = SearchOption.TopDirectoryOnly;
+            if (recursive)
+                searchOption = SearchOption.AllDirectories;
+
+            var files = Directory.GetFiles(path, $"*.{fileExtension}", searchOption);
+            if (!files.Any())
+            {
+                _errors.Add($"There are no {fileExtension} files in {path}!");
+                return;
+            }
+
+            foreach (var file in files)
+                callback(file);
+        }
+
+        private static bool CheckForFile(string argument, string fileExtension, Action<string> callback)
+        {
+            if (!File.Exists(argument))
+                return false;
+
+            var extension = Path.GetExtension(argument);
+            if (string.IsNullOrWhiteSpace(extension))
+            {
+                _errors.Add($"Can't establish extension of {argument}!");
+                return false;
+            }
+
+            if (!extension.Equals($".{fileExtension}"))
+            {
+                _errors.Add($"Extension of {argument} doesn't match {fileExtension}!");
+                return false;
+            }
+
+            callback(argument);
+            return true;
+        }
+
+        public static IEnumerable<string> Process(IEnumerable<string> arguments, string fileExtension, Action<string> callback, bool recursive = false)
+        {
+            _errors = new List<string>();
+
+            foreach (var argument in arguments)
+            {
+                if (CheckForFile(argument, fileExtension, callback))
+                    continue;
+
+                if (!Directory.Exists(argument))
+                {
+                    _errors.Add($"{argument} is neither file nor directory!");
+                    continue;
+                }
+
+                ProcessDir(argument, fileExtension, callback, recursive);
+            }
+
+            return _errors;
+        }
+    }
+}

+ 14 - 0
ProcessFiles/ProcessFiles.projitems

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
+    <HasSharedItems>true</HasSharedItems>
+    <SharedGUID>beaa09ee-f7d8-458c-a457-1bd3c8428671</SharedGUID>
+  </PropertyGroup>
+  <PropertyGroup Label="Configuration">
+    <Import_RootNamespace>ProcessFiles</Import_RootNamespace>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildThisFileDirectory)ProcessFiles.cs" />
+  </ItemGroup>
+</Project>

+ 13 - 0
ProcessFiles/ProcessFiles.shproj

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>beaa09ee-f7d8-458c-a457-1bd3c8428671</ProjectGuid>
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
+  <PropertyGroup />
+  <Import Project="ProcessFiles.projitems" Label="Shared" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
+</Project>

+ 110 - 0
ProcessFilesTests/ProcessFilesTests.cs

@@ -0,0 +1,110 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace ProcessFilesTests
+{
+    public class ProcessFilesTests
+    {
+        [Fact]
+        public void ProcessFolderTest()
+        {
+            const string expected = "test1.txt";
+            var result = string.Empty;
+
+            void Callback(string value)
+            {
+               result = Path.GetFileName(value);
+            }
+
+            var errors = ProcessFiles.ProcessFiles.Process(new [] {"./testFiles"}, "txt", Callback);
+            Assert.Empty(errors);
+
+            Assert.Equal(expected, result);
+        }
+
+        [Fact]
+        public void ProcessFolderRecursiveTest()
+        {
+            var expected = new[]
+            {
+                "test1.txt",
+                "test2.txt"
+            };
+
+            var result = new List<string>();
+            void Callback(string value)
+            {
+                result.Add(Path.GetFileName(value));
+            }
+
+            var errors = ProcessFiles.ProcessFiles.Process(new[] { "./testFiles" }, "txt", Callback, true);
+            Assert.Empty(errors);
+
+            bool CheckResult()
+            {
+                foreach (var item in result)
+                {
+                    if (!expected.Contains(item))
+                        return false;
+                }
+
+                return true;
+            }
+
+            Assert.True(CheckResult());
+        }
+
+        [Fact]
+        public void ProcessFileTest()
+        {
+            var expected = @"./testFiles/test1.txt";
+            var result = string.Empty;
+
+            void Callback(string value)
+            {
+                result = value;
+            }
+
+            var errors = ProcessFiles.ProcessFiles.Process(new[] { "./testFiles/test1.txt" }, "txt", Callback);
+            Assert.Empty(errors);
+
+            Assert.Equal(expected, result);
+        }
+
+        [Fact]
+        public void ProcessFileNotExistTest()
+        {
+            var expected = @"./testFiles/test1.txt";
+            var result = string.Empty;
+
+            void Callback(string value)
+            {
+                result = value;
+            }
+
+            var errors = ProcessFiles.ProcessFiles.Process(new[] { "./testFiles/test.txt" }, "txt", Callback);
+            Assert.NotEmpty(errors);
+
+            Assert.NotEqual(expected, result);
+        }
+
+        [Fact]
+        public void ProcessFileNotMatchExtensionTest()
+        {
+            var expected = @"./testFiles/test1.txt";
+            var result = string.Empty;
+
+            void Callback(string value)
+            {
+                result = value;
+            }
+
+            var errors = ProcessFiles.ProcessFiles.Process(new[] { "./testFiles/test1.txt" }, "abc", Callback);
+            Assert.NotEmpty(errors);
+
+            Assert.NotEqual(expected, result);
+        }
+    }
+}

+ 22 - 0
ProcessFilesTests/ProcessFilesTests.projitems

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
+    <HasSharedItems>true</HasSharedItems>
+    <SharedGUID>7a54c797-34e2-44df-afb5-2f0af14ddc5f</SharedGUID>
+  </PropertyGroup>
+  <PropertyGroup Label="Configuration">
+    <Import_RootNamespace>ProcessFilesTests</Import_RootNamespace>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildThisFileDirectory)ProcessFilesTests.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="$(MSBuildThisFileDirectory)testFiles\subFolder\test2.txt">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="$(MSBuildThisFileDirectory)testFiles\test1.txt">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+</Project>

+ 13 - 0
ProcessFilesTests/ProcessFilesTests.shproj

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>7a54c797-34e2-44df-afb5-2f0af14ddc5f</ProjectGuid>
+    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
+  <PropertyGroup />
+  <Import Project="ProcessFilesTests.projitems" Label="Shared" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
+</Project>

+ 0 - 0
ProcessFilesTests/testFiles/subFolder/test2.txt


+ 0 - 0
ProcessFilesTests/testFiles/test1.txt