diff --git a/.gitignore b/.gitignore index 8f225c7..52d82c9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ ## files generated by popular Visual Studio add-ons. # User-specific files +.vs/ *.suo *.user *.sln.docstates @@ -96,7 +97,8 @@ publish/ # NuGet Packages Directory ## TODO: If you have NuGet Package Restore enabled, uncomment the next line -#packages/ +packages/ +.nuget/ # Windows Azure Build Output csx diff --git a/.nuget/packages.config b/.nuget/packages.config deleted file mode 100644 index 3f307c0..0000000 --- a/.nuget/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/CodeGuard.sln b/CodeGuard.sln index 6ee8c08..bebfd78 100644 --- a/CodeGuard.sln +++ b/CodeGuard.sln @@ -1,12 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seterlund.CodeGuard", "CodeGuard\Seterlund.CodeGuard.csproj", "{534D625B-C310-4A98-8E05-1806E7AE389F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seterlund.CodeGuard.UnitTests", "UnitTests\Seterlund.CodeGuard.UnitTests.csproj", "{B7F516F7-E137-4922-B119-C87FFCDA8BBB}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96AC009B-2319-4A8C-B041-5294C8C1FA0F}" ProjectSection(SolutionItems) = preProject CodeGuard.vsmdi = CodeGuard.vsmdi @@ -17,10 +13,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{FF11F4C5-F6B5-4602-8BAB-3D3E003A8926}" - ProjectSection(SolutionItems) = preProject - .nuget\packages.config = .nuget\packages.config - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seterlund.CodeGuard", "CodeGuard\Seterlund.CodeGuard.csproj", "{574D0826-8269-4B3F-A323-F0C455B5D4A6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seterlund.CodeGuard.UnitTests", "UnitTests\Seterlund.CodeGuard.UnitTests.csproj", "{48F97F31-E9E9-4D52-AB96-1CC70C0827BD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -28,18 +23,21 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {534D625B-C310-4A98-8E05-1806E7AE389F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {534D625B-C310-4A98-8E05-1806E7AE389F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {534D625B-C310-4A98-8E05-1806E7AE389F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {534D625B-C310-4A98-8E05-1806E7AE389F}.Release|Any CPU.Build.0 = Release|Any CPU - {B7F516F7-E137-4922-B119-C87FFCDA8BBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B7F516F7-E137-4922-B119-C87FFCDA8BBB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B7F516F7-E137-4922-B119-C87FFCDA8BBB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B7F516F7-E137-4922-B119-C87FFCDA8BBB}.Release|Any CPU.Build.0 = Release|Any CPU + {574D0826-8269-4B3F-A323-F0C455B5D4A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {574D0826-8269-4B3F-A323-F0C455B5D4A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {574D0826-8269-4B3F-A323-F0C455B5D4A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {574D0826-8269-4B3F-A323-F0C455B5D4A6}.Release|Any CPU.Build.0 = Release|Any CPU + {48F97F31-E9E9-4D52-AB96-1CC70C0827BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48F97F31-E9E9-4D52-AB96-1CC70C0827BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48F97F31-E9E9-4D52-AB96-1CC70C0827BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48F97F31-E9E9-4D52-AB96-1CC70C0827BD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61B83B09-35B8-411B-BDB2-2B481E10C655} + EndGlobalSection GlobalSection(CodealikeProperties) = postSolution SolutionGuid = 9f50192f-59e9-4b4e-b3eb-19272024fdac EndGlobalSection diff --git a/CodeGuard/Properties/AssemblyInfo.cs b/CodeGuard/Properties/AssemblyInfo.cs deleted file mode 100644 index 4d2a4fb..0000000 --- a/CodeGuard/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("CodeGuard")] -[assembly: AssemblyDescription("Guard and Validator library.\nExample: Guard.That(arg1).IsNotNull().GreaterThan(100);\nThrows an exception if conditions are not met.\nSupports the ability to get a list of the failed conditions.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Per Ivar Seterlund")] -[assembly: AssemblyProduct("CodeGuard")] -[assembly: AssemblyCopyright("Copyright Per Ivar Seterlund © 2014")] -[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("fff91309-52b0-4bd4-8099-56d798b14116")] - -// 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("2.3.4.*")] -[assembly: AssemblyFileVersion("2.3.4.*")] diff --git a/CodeGuard/Seterlund.CodeGuard.csproj b/CodeGuard/Seterlund.CodeGuard.csproj index bb56844..527df1d 100644 --- a/CodeGuard/Seterlund.CodeGuard.csproj +++ b/CodeGuard/Seterlund.CodeGuard.csproj @@ -1,177 +1,33 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {534D625B-C310-4A98-8E05-1806E7AE389F} - Library - Properties - Seterlund.CodeGuard - Seterlund.CodeGuard - v4.5 - 512 - - - 0 + netstandard2.0 + Per Ivar Seterlund + 2.4.0.0 + 2.4.0.0 + CodeGuard + MetaFight.CodeGuard + Per Ivar Seterlund + CodeGuard + Guard and Validator library. +Example: Guard.That(arg1).IsNotNull().GreaterThan(100); +Throws an exception if conditions are not met. +Supports the ability to get a list of the failed conditions. + Copyright Per Ivar Seterlund © 2011-2018 + true + 2.4.0 + https://raw.githubusercontent.com/MetaFight/Guard/master/License.txt + https://github.com/MetaFight/Guard + https://raw.githubusercontent.com/MetaFight/Guard/master/Images/shield2.png + Argument Guard Validation + The original project seemed dead, so I've forked it and converted it to netstandard project. + + + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - False - False - True - False - False - True - True - True - True - True - False - False - True - True - True - True - True - True - True - False - False - False - True - False - False - True - True - False - False - - - - - - - - True - False - False - True - Full - Build - 0 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - False - False - True - False - False - False - True - True - True - True - False - False - True - True - True - True - True - True - True - False - False - False - True - False - True - True - True - False - False - - - - - - - - True - False - False - True - Full - Build - 0 - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - \ No newline at end of file + + diff --git a/CodeGuard/Seterlund.CodeGuard.csproj.user b/CodeGuard/Seterlund.CodeGuard.csproj.user deleted file mode 100644 index 07dbd5b..0000000 --- a/CodeGuard/Seterlund.CodeGuard.csproj.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - ProjectFiles - - \ No newline at end of file diff --git a/NuGet/.gitignore b/NuGet/.gitignore deleted file mode 100644 index 22d71c8..0000000 --- a/NuGet/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.nupkg diff --git a/NuGet/Seterlund.CodeGuard.1.0.nupkg b/NuGet/Seterlund.CodeGuard.1.0.nupkg deleted file mode 100644 index e700fe3..0000000 Binary files a/NuGet/Seterlund.CodeGuard.1.0.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.1.1.nupkg b/NuGet/Seterlund.CodeGuard.1.1.nupkg deleted file mode 100644 index 468e2f4..0000000 Binary files a/NuGet/Seterlund.CodeGuard.1.1.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.0.nupkg b/NuGet/Seterlund.CodeGuard.2.0.nupkg deleted file mode 100644 index 92c4901..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.0.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.1.nupkg b/NuGet/Seterlund.CodeGuard.2.1.nupkg deleted file mode 100644 index 1375d08..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.1.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.2.1.nupkg b/NuGet/Seterlund.CodeGuard.2.2.1.nupkg deleted file mode 100644 index 70d715b..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.2.1.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.2.2.nupkg b/NuGet/Seterlund.CodeGuard.2.2.2.nupkg deleted file mode 100644 index 4ecb108..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.2.2.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.2.3.nupkg b/NuGet/Seterlund.CodeGuard.2.2.3.nupkg deleted file mode 100644 index 52e9df9..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.2.3.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.2.4.nupkg b/NuGet/Seterlund.CodeGuard.2.2.4.nupkg deleted file mode 100644 index c84a2d9..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.2.4.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.2.2.nupkg b/NuGet/Seterlund.CodeGuard.2.2.nupkg deleted file mode 100644 index 5ba5357..0000000 Binary files a/NuGet/Seterlund.CodeGuard.2.2.nupkg and /dev/null differ diff --git a/NuGet/Seterlund.CodeGuard.nuspec b/NuGet/Seterlund.CodeGuard.nuspec deleted file mode 100644 index b9b8e1c..0000000 --- a/NuGet/Seterlund.CodeGuard.nuspec +++ /dev/null @@ -1,23 +0,0 @@ - - - - Seterlund.CodeGuard - 2.3.4 - CodeGuard - Per Ivar Seterlund - Per Ivar Seterlund - https://github.com/3komma14/Guard/blob/master/License.txt - https://github.com/3komma14/Guard/wiki - https://github.com/3komma14/Guard/raw/master/Images/shield2.png - false - Guard and Validator library. - Example: Guard.That(arg1).IsNotNull().GreaterThan(100); - Throws an exception if conditions are not met. - Supports the ability to get a list of the failed conditions. - Copyright Per Ivar Seterlund (3komma14@gmail.com) 2011-2014 - Argument Guard Validation - - Added support for enums, and added various new guards - - - \ No newline at end of file diff --git a/NuGet_Src/.gitignore b/NuGet_Src/.gitignore deleted file mode 100644 index 22d71c8..0000000 --- a/NuGet_Src/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.nupkg diff --git a/NuGet_Src/Seterlund.CodeGuard.Source.nuspec b/NuGet_Src/Seterlund.CodeGuard.Source.nuspec deleted file mode 100644 index 270a666..0000000 --- a/NuGet_Src/Seterlund.CodeGuard.Source.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - Seterlund.CodeGuard.Source - 2.3.4 - CodeGuard (Source) - Per Ivar Seterlund - Per Ivar Seterlund - https://github.com/3komma14/Guard/blob/master/License.txt - https://github.com/3komma14/Guard/wiki - https://github.com/3komma14/Guard/raw/master/Images/shield2.png - false - Guard and Validator library. - Example: Guard.That(arg1).IsNotNull().GreaterThan(100); - Throws an exception if conditions are not met. - Supports the ability to get a list of the failed conditions. - Copyright Per Ivar Seterlund (3komma14@gmail.com) 2011-2014 - Argument Guard Validation - - Added support for enums, and added various new guards - - - - - - \ No newline at end of file diff --git a/NuGet_Src/content/CodeGuard/ArrayValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/ArrayValidatorExtensions.cs.pp deleted file mode 100644 index 1dd8b77..0000000 --- a/NuGet_Src/content/CodeGuard/ArrayValidatorExtensions.cs.pp +++ /dev/null @@ -1,27 +0,0 @@ -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class ArrayValidatorExtensions - { - public static IArg IsNotEmpty(this IArg arg) - { - if (arg.Value == null || arg.Value.Length == 0) - { - arg.Message.Set("Array is empty"); - } - - return arg; - } - - public static IArg CountIs(this IArg arg, int count) - { - if (arg.Value == null || arg.Value.Length != count) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/BooleanValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/BooleanValidatorExtensions.cs.pp deleted file mode 100644 index b930047..0000000 --- a/NuGet_Src/content/CodeGuard/BooleanValidatorExtensions.cs.pp +++ /dev/null @@ -1,27 +0,0 @@ -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class BooleanValidatorExtensions - { - public static IArg IsTrue(this IArg arg) - { - return IsValid(arg, true); - } - - public static IArg IsFalse(this IArg arg) - { - return IsValid(arg, false); - } - - private static IArg IsValid(IArg arg, bool expected) - { - if (arg.Value != expected) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/ClassValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/ClassValidatorExtensions.cs.pp deleted file mode 100644 index 2938200..0000000 --- a/NuGet_Src/content/CodeGuard/ClassValidatorExtensions.cs.pp +++ /dev/null @@ -1,17 +0,0 @@ -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class ClassValidatorExtensions - { - public static IArg IsNotNull(this IArg arg) where T : class - { - if (arg.Value == null) - { - arg.Message.SetArgumentNull(); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/CollectionValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/CollectionValidatorExtensions.cs.pp deleted file mode 100644 index 01a6116..0000000 --- a/NuGet_Src/content/CodeGuard/CollectionValidatorExtensions.cs.pp +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections; - -namespace $rootnamespace$.CodeGuard -{ - public static class CollectionValidatorExtensions - { - public static IArg IsNotEmpty(this IArg arg) - { - if (arg.Value.Count > 0) - { - arg.Message.Set("Collection is empty"); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/ComparableValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/ComparableValidatorExtensions.cs.pp deleted file mode 100644 index e95ae33..0000000 --- a/NuGet_Src/content/CodeGuard/ComparableValidatorExtensions.cs.pp +++ /dev/null @@ -1,77 +0,0 @@ -using System; - -namespace $rootnamespace$.CodeGuard -{ - public static class ComparableValidatorExtensions - { - public static IArg IsEqual(this IArg arg, T param) where T : IComparable - { - return IsEqual(arg, () => param); - } - - public static IArg IsEqual(this IArg arg, Func param) where T : IComparable - { - if (arg.Value.CompareTo(param()) != 0) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsNotEqual(this IArg arg, T param) where T: IComparable - { - return IsNotEqual(arg, () => param); - } - - public static IArg IsNotEqual(this IArg arg, Func param) where T: IComparable - { - if (arg.Value.CompareTo(param()) == 0) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsGreaterThan(this IArg arg, T param) where T : IComparable - { - return IsGreaterThan(arg, () => param); - } - - public static IArg IsGreaterThan(this IArg arg, Func param) where T : IComparable - { - if (arg.Value.CompareTo(param()) <= 0) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsLessThan(this IArg arg, T param) where T : IComparable - { - return IsLessThan(arg, () => param); - } - - public static IArg IsLessThan(this IArg arg, Func param) where T : IComparable - { - if (arg.Value.CompareTo(param()) >= 0) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsInRange(this IArg arg, T start, T end) where T : IComparable - { - if (arg.Value.CompareTo(start) < 0 || arg.Value.CompareTo(end) > 0) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/EnumValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/EnumValidatorExtensions.cs.pp deleted file mode 100644 index cacd440..0000000 --- a/NuGet_Src/content/CodeGuard/EnumValidatorExtensions.cs.pp +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class EnumValidatorExtensions - { - public static IArg IsValidValue(this IArg arg) - { - if (!Enum.IsDefined(arg.Value.GetType(), arg.Value)) - { - arg.Message.Set("Value is not valid"); - } - - return arg; - } - - public static IArg HasFlagSet(this IArg arg, TEnum flagValue) - { - Enum value = arg.Value as Enum; - Enum flagEnumValue = flagValue as Enum; - if (value != null) - { - if (!value.HasFlag(flagEnumValue)) - { - arg.Message.Set("Value does not have flag set"); - } - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/EnumerableValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/EnumerableValidatorExtensions.cs.pp deleted file mode 100644 index 70275b6..0000000 --- a/NuGet_Src/content/CodeGuard/EnumerableValidatorExtensions.cs.pp +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace $rootnamespace$.CodeGuard -{ - public static class EnumerableValidatorExtensions - { - public static IArg> IsNotEmpty(this IArg> arg) - { - if (!arg.Value.Any()) - { - arg.Message.Set("Collection is empty"); - } - - return arg; - } - - public static IArg> Length(this IArg> arg, int length) - { - if (arg.Value.Count() != length) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg> Contains(this IArg> arg, Func predicate) - { - - if (!arg.Value.Any(predicate)) - { - arg.Message.Set("Collection does not contain required object"); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/ErrorInfo.cs.pp b/NuGet_Src/content/CodeGuard/ErrorInfo.cs.pp deleted file mode 100644 index 503432a..0000000 --- a/NuGet_Src/content/CodeGuard/ErrorInfo.cs.pp +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace $rootnamespace$.CodeGuard -{ - public class ErrorInfo - { - public string Name { get; set; } - public string Message { get; set; } - } -} diff --git a/NuGet_Src/content/CodeGuard/Guard.cs.pp b/NuGet_Src/content/CodeGuard/Guard.cs.pp deleted file mode 100644 index a87edb6..0000000 --- a/NuGet_Src/content/CodeGuard/Guard.cs.pp +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Linq.Expressions; -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class Guard - { - /// - /// Check the argument - /// - /// - /// The argument. - /// - /// - /// Type of the argument - /// - /// - /// An ArgumentValidator - /// - public static IArg That(Expression> argument) - { - return new ThrowOnFirstErrorArg(argument); - } - - /// - /// Check the argument - /// - /// - /// Type of the argument - /// - /// - /// - /// - /// An ArgumentValidator - /// - public static IArg That(T argument, string argumentName = "") - { - if (string.IsNullOrEmpty(argumentName)) - { - return new ThrowOnFirstErrorArg(argument); - } - return new ThrowOnFirstErrorArg(argument, argumentName); - } - } -} diff --git a/NuGet_Src/content/CodeGuard/GuidValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/GuidValidatorExtensions.cs.pp deleted file mode 100644 index 588dc0a..0000000 --- a/NuGet_Src/content/CodeGuard/GuidValidatorExtensions.cs.pp +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace $rootnamespace$.CodeGuard -{ - public static class GuidValidatorExtensions - { - public static IArg IsNotEmpty(this IArg arg) - { - if (Guid.Empty.Equals(arg.Value)) - { - arg.Message.Set("Guid is empty"); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/IArg.cs.pp b/NuGet_Src/content/CodeGuard/IArg.cs.pp deleted file mode 100644 index 68e0db4..0000000 --- a/NuGet_Src/content/CodeGuard/IArg.cs.pp +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public interface IArg - { - T Value { get; } - ArgName Name { get; } - IMessageHandler Message { get; } - IEnumerable Errors { get; } - } -} diff --git a/NuGet_Src/content/CodeGuard/IntegerValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/IntegerValidatorExtensions.cs.pp deleted file mode 100644 index f2c0069..0000000 --- a/NuGet_Src/content/CodeGuard/IntegerValidatorExtensions.cs.pp +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class IntegerValidatorExtensions - { - public static IArg IsOdd(this IArg arg) - { - if (!MathUtil.IsOdd(arg.Value)) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsOdd(this IArg arg) - { - if (!MathUtil.IsOdd(arg.Value)) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsEven(this IArg arg) - { - if (!MathUtil.IsEven(arg.Value)) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsEven(this IArg arg) - { - if (!MathUtil.IsEven(arg.Value)) - { - arg.Message.SetArgumentOutRange(); - } - - return arg; - } - - public static IArg IsPrime(this IArg arg) - { - if (!MathUtil.IsPrime(arg.Value)) - { - arg.Message.Set("Not a prime number"); - } - - return arg; - } - - public static IArg IsPrime(this IArg arg) - { - if (!MathUtil.IsPrime(arg.Value)) - { - arg.Message.Set("Not a prime number"); - } - - return arg; - } - - public static IArg IsPositive(this IArg arg) - { - if (arg.Value <= 0) - { - arg.Message.Set("Is not positive"); - } - - return arg; - } - - public static IArg IsPositive(this IArg arg) - { - if (arg.Value <= 0) - { - arg.Message.Set("Is not positive"); - } - - return arg; - } - - public static IArg IsNegative(this IArg arg) - { - if (arg.Value >= 0) - { - arg.Message.Set("Is not negative"); - } - - return arg; - } - - public static IArg IsNegative(this IArg arg) - { - if (arg.Value >= 0) - { - arg.Message.Set("Is not negative"); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/AccumulateErrorsArg.cs.pp b/NuGet_Src/content/CodeGuard/Internals/AccumulateErrorsArg.cs.pp deleted file mode 100644 index 228a58d..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/AccumulateErrorsArg.cs.pp +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public class AccumulateErrorsArg : ArgBaseExpression - { - - public AccumulateErrorsArg(Expression> argument) - : base(argument) - { - this.Message = new SaveMessageHandler(this); - } - - public AccumulateErrorsArg(T argument) - : base(argument) - { - this.Message = new SaveMessageHandler(this); - } - - public AccumulateErrorsArg(T argument, string argumentName) - : base(argument, argumentName) - { - this.Message = new SaveMessageHandler(this); - } - - public override IEnumerable Errors - { - get { return ((SaveMessageHandler)this.Message).GetResult(); } - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ArgBase.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ArgBase.cs.pp deleted file mode 100644 index 8c4eeb2..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ArgBase.cs.pp +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public abstract class ArgBase : IArg - { - private readonly Func _argument; - public IMessageHandler Message { get; protected set; } - - public abstract IEnumerable Errors { get; } - - public T Value { get; protected set; } - - public ArgName Name { get; private set; } - - #region Constructors - - protected ArgBase(Func argument) - { - _argument = argument; - - this.Value = GetValue(argument); - this.Name = new ArgNameFunc(argument); - } - - private static T GetValue(Func argument) - { - return argument(); - } - - protected ArgBase(T argument) - { - this.Value = argument; - } - - protected ArgBase(T argument, string argumentName) - { - this.Value = argument; - this.Name = new ArgName { Value = argumentName }; - } - - #endregion - - /// - /// Is argument instance of type - /// - /// The type to check - /// - public IArg Is() - { - var isType = this.Value is TType; - if (!isType) - { - this.Message.Set(string.Format("Value is not <{0}>", typeof(TType).Name)); - } - - return this; - } - } - -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ArgBaseExpression.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ArgBaseExpression.cs.pp deleted file mode 100644 index 739df5e..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ArgBaseExpression.cs.pp +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using System.Reflection; -using System.Runtime.CompilerServices; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public abstract class ArgBaseExpression : IArg - { - public IMessageHandler Message { get; protected set; } - - public abstract IEnumerable Errors { get; } - - public T Value { get; protected set; } - - public ArgName Name { get; private set; } - - #region Constructors - - protected ArgBaseExpression(Expression> argument) - { - this.Value = GetValue(argument); - this.Name = new ArgNameExpression(argument); - } - - private static T GetValue2(Expression> argument) - { - var memberExpression = (MemberExpression) argument.Body; - var constantExpression = (ConstantExpression) memberExpression.Expression; - object value; - if (memberExpression.Member.MemberType == MemberTypes.Property) - { - value = ((PropertyInfo) memberExpression.Member).GetValue(constantExpression.Value, null); - } - else - { - value = ((FieldInfo) memberExpression.Member).GetValue(constantExpression.Value); - } - return (T) value; - } - - - private static T GetValue(Expression> argument) - { - var memberExpression = (MemberExpression) argument.Body; - object value; - if (memberExpression.Expression.NodeType == ExpressionType.Constant) - { - var constantExpression = (ConstantExpression)memberExpression.Expression; - if (memberExpression.Member.MemberType == MemberTypes.Property) - { - value = ((PropertyInfo)memberExpression.Member).GetValue(constantExpression.Value, null); - } - else - { - value = ((FieldInfo)memberExpression.Member).GetValue(constantExpression.Value); - } - } - else - { - value = argument.Compile().DynamicInvoke(); - } - return (T)value; - - } - - protected ArgBaseExpression(T argument) - { - this.Value = argument; - } - - protected ArgBaseExpression(T argument, string argumentName) - { - this.Value = argument; - this.Name = new ArgName { Value = argumentName }; - } - - #endregion - - /// - /// Is argument instance of type - /// - /// The type to check - /// - public IArg Is() - { - var isType = this.Value is TType; - if (!isType) - { - this.Message.Set(string.Format("Value is not <{0}>", typeof(TType).Name)); - } - - return this; - } - } - -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ArgName.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ArgName.cs.pp deleted file mode 100644 index 70eef4c..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ArgName.cs.pp +++ /dev/null @@ -1,13 +0,0 @@ -namespace $rootnamespace$.CodeGuard.Internals -{ - public class ArgName - { - public virtual string Value { get; set; } - - public static implicit operator string(ArgName argName) - { - if (argName == null) return null; - return argName.Value; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ArgNameExpression.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ArgNameExpression.cs.pp deleted file mode 100644 index ff8d758..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ArgNameExpression.cs.pp +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Linq.Expressions; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public class ArgNameExpression : ArgName - { - private readonly Expression> _argument; - private string _nameValue; - - public ArgNameExpression(Expression> argument) - { - _argument = argument; - } - - public override string Value - { - get - { - if(_nameValue == null) - { - _nameValue = GetArgName(_argument); - } - return _nameValue; - } - set - { - _nameValue = value; - } - } - - private static string GetArgName(Expression> argument) - { - var memberExpression = argument.Body as MemberExpression; - if(memberExpression != null) - { - return memberExpression.Member.Name; - } - throw new InvalidOperationException("Unable to get name from expression"); - } - - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ArgNameFunc.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ArgNameFunc.cs.pp deleted file mode 100644 index 7a5a687..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ArgNameFunc.cs.pp +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public class ArgNameFunc : ArgName - { - private readonly Func _argument; - private string _nameValue; - - public ArgNameFunc(Func argument) - { - _argument = argument; - } - - public override string Value - { - get - { - if(_nameValue == null) - { - _nameValue = GetArgumentName(); - } - return _nameValue; - } - set - { - _nameValue = value; - } - } - - private string GetArgumentName() - { - var memberInfoReader = new MemberInfoReader(_argument); - var name = memberInfoReader.GetInfo().Name; - return name.StartsWith("get_") ? name.Substring(4) : name; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/EnumExtensions.cs.pp b/NuGet_Src/content/CodeGuard/Internals/EnumExtensions.cs.pp deleted file mode 100644 index 0fac992..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/EnumExtensions.cs.pp +++ /dev/null @@ -1,32 +0,0 @@ -using System; - -namespace $rootnamespace$.CodeGuard.Internals -{ - /// - /// Extentions for enums. - /// http://www.sambeauvois.be/blog/2011/08/enum-hasflag-method-extension-for-4-0-framework/ - /// - public static class EnumExtensions - { - /// - /// A FX 3.5 way to mimic the FX4 "HasFlag" method. - /// - /// The tested enum. - /// The value to test. - /// True if the flag is set. Otherwise false. - public static bool HasFlag(this Enum variable, Enum value) - { - // check if from the same type. - if (variable.GetType() != value.GetType()) - { - throw new ArgumentException("The checked flag is not from the same type as the checked variable."); - } - - Convert.ToUInt64(value); - ulong num = Convert.ToUInt64(value); - ulong num2 = Convert.ToUInt64(variable); - - return (num2 & num) == num; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ErrorHandlerBase.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ErrorHandlerBase.cs.pp deleted file mode 100644 index 87b3167..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ErrorHandlerBase.cs.pp +++ /dev/null @@ -1,12 +0,0 @@ -namespace $rootnamespace$.CodeGuard.Internals -{ - internal class ErrorHandlerBase - { - public IArg Arg { get; set; } - - public ErrorHandlerBase(IArg arg) - { - Arg = arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/IMessageHandler.cs.pp b/NuGet_Src/content/CodeGuard/Internals/IMessageHandler.cs.pp deleted file mode 100644 index d2ab28c..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/IMessageHandler.cs.pp +++ /dev/null @@ -1,9 +0,0 @@ -namespace $rootnamespace$.CodeGuard.Internals -{ - public interface IMessageHandler - { - void Set(string message); - void SetArgumentNull(); - void SetArgumentOutRange(); - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/MathUtil.cs.pp b/NuGet_Src/content/CodeGuard/Internals/MathUtil.cs.pp deleted file mode 100644 index 5eda225..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/MathUtil.cs.pp +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public class MathUtil - { - public static bool IsOdd(int value) - { - return ((value & 1) == 1); - } - - public static bool IsOdd(long value) - { - return ((value & 1) == 1); - } - - public static bool IsEven(int value) - { - return ((value & 1) == 0); - } - - public static bool IsEven(long value) - { - return ((value & 1) == 0); - } - - public static bool IsPrime(int value) - { - return IsPrime((long)value); - } - - public static bool IsPrime(long value) - { - // Throw out impossibles - if (value < 2) - { - return false; - } - - // Don't need to test above the square root of a number - var squareRootOfValue = (int)Math.Sqrt(value); - for (var i = 2; i <= squareRootOfValue; i++) - { - // If remainder is 0, number is not prime - if (value % i == 0) - { - // return false - return false; - } - } - - // If all conditions are met, return true - return true; - } - - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/MemberInfoReader.cs.pp b/NuGet_Src/content/CodeGuard/Internals/MemberInfoReader.cs.pp deleted file mode 100644 index 250ba31..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/MemberInfoReader.cs.pp +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Diagnostics; -using System.Reflection; -using System.Reflection.Emit; - -namespace $rootnamespace$.CodeGuard.Internals -{ - internal class MemberInfoReader - { - private static OpCode[] singleByteOpCodes; - private readonly Func _arg; - - internal MemberInfoReader(Func arg) - { - this._arg = arg; - } - - public static OpCode[] SingleByteOpCodes - { - get - { - if (singleByteOpCodes == null) - { - LoadOpCodes(); - } - return singleByteOpCodes; - } - } - - public MemberInfo GetInfo() - { - byte[] methodBodyIlByteArray = GetMethodBodyIlByteArray(); - - var argumentInfo = GetArgumentInfo(methodBodyIlByteArray); - if (argumentInfo != null) - { - return GetMemberInfo(argumentInfo); - } - throw new InvalidExpressionException("Unable to get information about member"); - } - - private MemberInfo GetMemberInfo(ArgumentInfo argumentInfo) - { - MemberInfo memberInfo = null; - - if (argumentInfo.Token > 0) - { - var argType = _arg.Target.GetType(); - var genericTypeArguments = GetSubclassGenericTypes(argType); - var genericMethodArguments = _arg.Method.GetGenericArguments(); - - switch (argumentInfo.OperandType) - { - case OperandType.InlineField: - memberInfo = argType.Module.ResolveField(argumentInfo.Token, genericTypeArguments, - genericMethodArguments); - break; - case OperandType.InlineMethod: - memberInfo = argType.Module.ResolveMethod(argumentInfo.Token, genericTypeArguments, - genericMethodArguments); - break; - } - } - - return memberInfo; - } - - private static OpCode GetOpCode(byte[] methodBodyIlByteArray, ref int currentPosition) - { - ushort value = methodBodyIlByteArray[currentPosition++]; - return value != 0xfe ? SingleByteOpCodes[value] : OpCodes.Nop; - } - - private static ArgumentInfo GetArgumentInfo(byte[] methodBodyIlByteArray) - { - int position = 0; - - while (position < methodBodyIlByteArray.Length) - { - var code = GetOpCode(methodBodyIlByteArray, ref position); - - - if (code.OperandType == OperandType.InlineField || code.OperandType == OperandType.InlineMethod) - { - return new ArgumentInfo - { - OperandType = code.OperandType, - Token = ReadInt32(methodBodyIlByteArray, ref position) - }; - } - - position = MoveToNextPosition(position, code); - } - - return null; - } - - private static int MoveToNextPosition(int position, OpCode code) - { - switch (code.OperandType) - { - case OperandType.InlineNone: - break; - - case OperandType.InlineI8: - case OperandType.InlineR: - position += 8; - break; - - case OperandType.InlineField: - case OperandType.InlineBrTarget: - case OperandType.InlineMethod: - case OperandType.InlineSig: - case OperandType.InlineTok: - case OperandType.InlineType: - case OperandType.InlineI: - case OperandType.InlineString: - case OperandType.InlineSwitch: - case OperandType.ShortInlineR: - position += 4; - break; - - case OperandType.InlineVar: - position += 2; - break; - - case OperandType.ShortInlineBrTarget: - case OperandType.ShortInlineI: - case OperandType.ShortInlineVar: - position++; - break; - - default: - throw new InvalidOperationException("Unknown operand type."); - } - return position; - } - - private byte[] GetMethodBodyIlByteArray() - { - //AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve); - - //foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) - //{ - // Debug.WriteLine(assembly.FullName); - // Console.WriteLine(assembly.FullName); - // //Assembly.ReflectionOnlyLoad(assembly.FullName); - //} - - var methodBody = _arg.Method.GetMethodBody(); - - if (methodBody == null) - { - throw new InvalidOperationException("Unable to get method body for expression"); - } - - return methodBody.GetILAsByteArray(); - } - - Assembly CurrentDomain_ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args) - { - Debug.WriteLine(args.Name); - Console.WriteLine("load: {0}", args.Name); - return Assembly.ReflectionOnlyLoad(args.Name); - } - - private static int ReadInt32(byte[] il, ref int position) - { - return ((il[position++] | (il[position++] << 8)) | (il[position++] << 0x10)) | (il[position++] << 0x18); - } - - private static Type[] GetSubclassGenericTypes(Type toCheck) - { - var genericArgumentsTypes = new List(); - - while (toCheck != null) - { - if (toCheck.IsGenericType) - { - genericArgumentsTypes.AddRange(toCheck.GetGenericArguments()); - } - - toCheck = toCheck.BaseType; - } - - return genericArgumentsTypes.ToArray(); - } - - private static void LoadOpCodes() - { - singleByteOpCodes = new OpCode[0x100]; - - var opcodeFieldInfos = typeof (OpCodes).GetFields(); - - foreach (var info1 in opcodeFieldInfos) - { - if (info1.FieldType == typeof (OpCode)) - { - var singleByteOpCode = (OpCode) info1.GetValue(null); - - var singleByteOpcodeIndex = (ushort) singleByteOpCode.Value; - - if (singleByteOpcodeIndex < 0x100) - { - singleByteOpCodes[singleByteOpcodeIndex] = singleByteOpCode; - } - } - } - } - - #region Nested type: ArgumentInfo - - private class ArgumentInfo - { - public OperandType OperandType; - public int Token; - } - - #endregion - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/SaveMessageHandler.cs.pp b/NuGet_Src/content/CodeGuard/Internals/SaveMessageHandler.cs.pp deleted file mode 100644 index af42c86..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/SaveMessageHandler.cs.pp +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; - -namespace $rootnamespace$.CodeGuard.Internals -{ - internal class SaveMessageHandler : IMessageHandler - { - private readonly IArg _arg; - protected List Result = new List(); - - public List GetResult() - { - return Result; - } - - public SaveMessageHandler(IArg arg) - { - _arg = arg; - } - - - public void Set(string message) - { - AddResultItem(message); - } - - public void SetArgumentNull() - { - AddResultItem("Argument is null."); - } - - public void SetArgumentOutRange() - { - AddResultItem("Argument is out of range."); - } - - private void AddResultItem(string message) - { - Result.Add(new ErrorInfo() {Message = message, Name = _arg.Name}); - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/StringExtensions.cs.pp b/NuGet_Src/content/CodeGuard/Internals/StringExtensions.cs.pp deleted file mode 100644 index dca07a0..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/StringExtensions.cs.pp +++ /dev/null @@ -1,11 +0,0 @@ -namespace $rootnamespace$.CodeGuard.Internals -{ - public static class StringExtensions - { - public static bool IsNullOrWhiteSpace(this string value) - { - if (value == null) return true; - return string.IsNullOrEmpty(value.Trim()); - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ThrowMessageHandler.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ThrowMessageHandler.cs.pp deleted file mode 100644 index 7cbf684..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ThrowMessageHandler.cs.pp +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace $rootnamespace$.CodeGuard.Internals -{ - internal class ThrowMessageHandler : IMessageHandler - { - private readonly IArg _arg; - - public ThrowMessageHandler(IArg arg) - { - _arg = arg; - } - - public void Set(string message) - { - if (string.IsNullOrEmpty(_arg.Name)) - { - throw new ArgumentException(message); - } - - throw new ArgumentException(message, _arg.Name); - } - - public void SetArgumentNull() - { - if (string.IsNullOrEmpty(_arg.Name)) - { - throw new ArgumentNullException(); - } - - throw new ArgumentNullException(_arg.Name); - } - - public void SetArgumentOutRange() - { - if (string.IsNullOrEmpty(_arg.Name)) - { - throw new ArgumentOutOfRangeException(); - } - - throw new ArgumentOutOfRangeException(_arg.Name); - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Internals/ThrowOnFirstErrorArg.cs.pp b/NuGet_Src/content/CodeGuard/Internals/ThrowOnFirstErrorArg.cs.pp deleted file mode 100644 index e3f9bab..0000000 --- a/NuGet_Src/content/CodeGuard/Internals/ThrowOnFirstErrorArg.cs.pp +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace $rootnamespace$.CodeGuard.Internals -{ - public class ThrowOnFirstErrorArg : ArgBaseExpression - { - #region Constructors - - public ThrowOnFirstErrorArg(Expression> argument) : base(argument) - { - this.Message = new ThrowMessageHandler(this); - } - - public ThrowOnFirstErrorArg(T argument) : base(argument) - { - this.Message = new ThrowMessageHandler(this); - } - - public ThrowOnFirstErrorArg(T argument, string argumentName) - : base(argument, argumentName) - { - this.Message = new ThrowMessageHandler(this); - } - - #endregion - - public override IEnumerable Errors - { - get { return null; } - } - } -} diff --git a/NuGet_Src/content/CodeGuard/NullableValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/NullableValidatorExtensions.cs.pp deleted file mode 100644 index a6900c7..0000000 --- a/NuGet_Src/content/CodeGuard/NullableValidatorExtensions.cs.pp +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace $rootnamespace$.CodeGuard -{ - public static class NullableValidatorExtensions - { - /// - /// Is argument instance of type - /// - /// - public static IArg IsNotNull(this IArg arg) where T: struct - { - if (arg.Value == null || !arg.Value.HasValue) - { - arg.Message.SetArgumentNull(); - } - - return arg; - } - - } -} diff --git a/NuGet_Src/content/CodeGuard/ObjectValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/ObjectValidatorExtensions.cs.pp deleted file mode 100644 index 4ef6bc2..0000000 --- a/NuGet_Src/content/CodeGuard/ObjectValidatorExtensions.cs.pp +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using $rootnamespace$.CodeGuard.Internals; -using System.Linq; - -namespace $rootnamespace$.CodeGuard -{ - public static class ObjectValidatorExtensions - { - /// - /// Is argument instance of type - /// - /// - public static IArg Is(this IArg arg, Type type) - { - var isType = type.IsInstanceOfType(arg.Value); - if (!isType) - { - arg.Message.Set(string.Format("Value is not <{0}>", type.Name)); - } - - return arg; - } - - /// - /// Is argument not the default value - /// - /// - public static IArg IsNotDefault(this IArg arg) - { - if (default(T).Equals(arg.Value)) - { - arg.Message.Set("Value cannot be the default value."); - - } - - return arg; - } - - /// - /// Is the function true for the argument. - /// - /// - public static IArg IsTrue(this IArg arg, Func booleanFunction, string exceptionMessage) - { - if (!booleanFunction(arg.Value)) - { - arg.Message.Set(exceptionMessage); - } - - return arg; - } - - public static IArg IsOneOf(this IArg arg, IEnumerable collection) - { - if (!collection.Contains(arg.Value)) - { - arg.Message.Set(string.Format("The value of the parameter is not one of {0}", string.Join(", ", collection.Select(x => x.ToString()).ToArray()))); - } - - return arg; - } - - } -} diff --git a/NuGet_Src/content/CodeGuard/Properties/AssemblyInfo.cs.pp b/NuGet_Src/content/CodeGuard/Properties/AssemblyInfo.cs.pp deleted file mode 100644 index 46dd949..0000000 --- a/NuGet_Src/content/CodeGuard/Properties/AssemblyInfo.cs.pp +++ /dev/null @@ -1,36 +0,0 @@ -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("CodeGuard")] -[assembly: AssemblyDescription("Guard and Validator library.\nExample: Guard.That(arg1).IsNotNull().GreaterThan(100);\nThrows an exception if conditions are not met.\nSupports the ability to get a list of the failed conditions.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Per Ivar $rootnamespace$.)] -[assembly: AssemblyProduct("CodeGuard")] -[assembly: AssemblyCopyright("Copyright Per Ivar $rootnamespace$.© 2014")] -[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("fff91309-52b0-4bd4-8099-56d798b14116")] - -// 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("2.3.4.*")] -[assembly: AssemblyFileVersion("2.3.4.*")] diff --git a/NuGet_Src/content/CodeGuard/StringValidatorExtensions.cs.pp b/NuGet_Src/content/CodeGuard/StringValidatorExtensions.cs.pp deleted file mode 100644 index 49740e5..0000000 --- a/NuGet_Src/content/CodeGuard/StringValidatorExtensions.cs.pp +++ /dev/null @@ -1,89 +0,0 @@ -using System.Text.RegularExpressions; -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class StringValidatorExtensions - { - public static IArg IsNotEmpty(this IArg arg) - { - if (arg.Value == string.Empty) - { - arg.Message.Set("String is empty"); - } - - return arg; - } - - public static IArg IsNotNullOrEmpty(this IArg arg) - { - if (string.IsNullOrEmpty(arg.Value)) - { - arg.Message.Set("String is null or empty"); - } - - return arg; - } - - public static IArg StartsWith(this IArg arg, string value) - { - if (!arg.Value.StartsWith(value)) - { - arg.Message.Set(string.Format("String must start with <{0}>", value)); - } - - return arg; - } - - public static IArg EndsWith(this IArg arg, string value) - { - if (!arg.Value.EndsWith(value)) - { - arg.Message.Set(string.Format("String must end with <{0}>", value)); - } - - return arg; - } - - public static IArg Length(this IArg arg, int length) - { - if (arg.Value.Length != length) - { - arg.Message.Set("String have wrong length"); - } - - return arg; - } - - public static IArg Contains(this IArg arg, string value) - { - if (!arg.Value.Contains(value)) - { - arg.Message.Set(string.Format("String must contain <{0}>", value)); - } - - return arg; - } - - public static IArg IsMatch(this IArg arg, string pattern) - { - var r = new Regex(pattern); - if (!r.IsMatch(arg.Value)) - { - arg.Message.Set(string.Format("String must match <{0}>", pattern)); - } - - return arg; - } - - public static IArg IsNotNullOrWhiteSpace(this IArg arg) - { - if (arg.Value.IsNullOrWhiteSpace()) - { - arg.Message.Set("String is null or whitespace"); - } - - return arg; - } - } -} diff --git a/NuGet_Src/content/CodeGuard/Validate.cs.pp b/NuGet_Src/content/CodeGuard/Validate.cs.pp deleted file mode 100644 index 3d4cf20..0000000 --- a/NuGet_Src/content/CodeGuard/Validate.cs.pp +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Linq.Expressions; -using $rootnamespace$.CodeGuard.Internals; - -namespace $rootnamespace$.CodeGuard -{ - public static class Validate - { - /// - /// Validate the argument - /// - /// - /// The argument. - /// - /// - /// Type of the argument - /// - /// - /// An ArgumentValidator - /// - public static IArg That(Expression> argument) - { - return new AccumulateErrorsArg(argument); - } - } -} diff --git a/NuGet_Src/replace.ps1 b/NuGet_Src/replace.ps1 deleted file mode 100644 index 2813a51..0000000 --- a/NuGet_Src/replace.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -$content = 'C:\Projects\Guard\NuGet_Src\content' - -if ((Test-Path -path $content)) -{ - Remove-Item -Recurse -Force $content -} -New-Item -Path $content -type directory - -Copy-Item C:\Projects\Guard\CodeGuard\ $content -recurse -verbose -filter "*.cs" - -Get-ChildItem -Recurse | Where-Object {$_.Name -match '.cs'} | Rename-Item -NewName { $_.Name -replace '.cs','.cs.pp' } - - -$old = 'Seterlund.' -$new = '$rootnamespace$.' - -Get-ChildItem $content -Recurse | Where {$_ -IS [IO.FileInfo]} | - -% { - -(Get-Content $_.FullName) -replace $old,$new | Set-Content $_.FullName - -Write-Host "Processed: " + $_.FullName - -} - diff --git a/Replace-FileString.ps1 b/Replace-FileString.ps1 deleted file mode 100644 index 99126a4..0000000 --- a/Replace-FileString.ps1 +++ /dev/null @@ -1,243 +0,0 @@ -# Replace-FileString.ps1 -# Written by Bill Stewart (bstewart@iname.com) -# -# Replaces strings in files using a regular expression. Supports -# multi-line searching and replacing. - -#requires -version 2 - -<# -.SYNOPSIS -Replaces strings in files using a regular expression. - -.DESCRIPTION -Replaces strings in files using a regular expression. Supports -multi-line searching and replacing. - -.PARAMETER Pattern -Specifies the regular expression pattern. - -.PARAMETER Replacement -Specifies the regular expression replacement pattern. - -.PARAMETER Path -Specifies the path to one or more files. Wildcards are permitted. Each -file is read entirely into memory to support multi-line searching and -replacing, so performance may be slow for large files. - -.PARAMETER LiteralPath -Specifies the path to one or more files. The value of the this -parameter is used exactly as it is typed. No characters are interpreted -as wildcards. Each file is read entirely into memory to support -multi-line searching and replacing, so performance may be slow for -large files. - -.PARAMETER CaseSensitive -Specifies case-sensitive matching. The default is to ignore case. - -.PARAMETER Multiline -Changes the meaning of ^ and $ so they match at the beginning and end, -respectively, of any line, and not just the beginning and end of the -entire file. The default is that ^ and $, respectively, match the -beginning and end of the entire file. - -.PARAMETER UnixText -Causes $ to match only linefeed (\n) characters. By default, $ matches -carriage return+linefeed (\r\n). (Windows-based text files usually use -\r\n as line terminators, while Unix-based text files usually use only -\n.) - -.PARAMETER Overwrite -Overwrites a file by creating a temporary file containing all -replacements and then replacing the original file with the temporary -file. The default is to output but not overwrite. - -.PARAMETER Force -Allows overwriting of read-only files. Note that this parameter cannot -override security restrictions. - -.PARAMETER Encoding -Specifies the encoding for the file when -Overwrite is used. Possible -values are: ASCII, BigEndianUnicode, Unicode, UTF32, UTF7, or UTF8. The -default value is ASCII. - -.INPUTS -System.IO.FileInfo. - -.OUTPUTS -System.String without the -Overwrite parameter, or nothing with the --Overwrite parameter. - -.LINK -about_Regular_Expressions - -.EXAMPLE -C:\>Replace-FileString.ps1 '(Ferb) and (Phineas)' '$2 and $1' Story.txt -This command replaces the string 'Ferb and Phineas' with the string -'Phineas and Ferb' in the file Story.txt and outputs the file. Note -that the pattern and replacement strings are enclosed in single quotes -to prevent variable expansion. - -.EXAMPLE -C:\>Replace-FileString.ps1 'Perry' 'Agent P' Ferb.txt -Overwrite -This command replaces the string 'Perry' with the string 'Agent P' in -the file Ferb.txt and overwrites the file. -#> - -[CmdletBinding(DefaultParameterSetName="Path", - SupportsShouldProcess=$TRUE)] -param( - [parameter(Mandatory=$TRUE,Position=0)] - [String] $Pattern, - [parameter(Mandatory=$TRUE,Position=1)] - [String] [AllowEmptyString()] $Replacement, - [parameter(Mandatory=$TRUE,ParameterSetName="Path", - Position=2,ValueFromPipeline=$TRUE)] - [String[]] $Path, - [parameter(Mandatory=$TRUE,ParameterSetName="LiteralPath", - Position=2)] - [String[]] $LiteralPath, - [Switch] $CaseSensitive, - [Switch] $Multiline, - [Switch] $UnixText, - [Switch] $Overwrite, - [Switch] $Force, - [String] $Encoding="ASCII" -) - -begin { - # Throw an error if $Encoding is not valid. - $encodings = @("ASCII","BigEndianUnicode","Unicode","UTF32","UTF7", - "UTF8") - if ($encodings -notcontains $Encoding) { - throw "Encoding must be one of the following: $encodings" - } - - # Extended test-path: Check the parameter set name to see if we - # should use -literalpath or not. - function test-pathEx($path) { - switch ($PSCmdlet.ParameterSetName) { - "Path" { - test-path $path - } - "LiteralPath" { - test-path -literalpath $path - } - } - } - - # Extended get-childitem: Check the parameter set name to see if we - # should use -literalpath or not. - function get-childitemEx($path) { - switch ($PSCmdlet.ParameterSetName) { - "Path" { - get-childitem $path -force - } - "LiteralPath" { - get-childitem -literalpath $path -force - } - } - } - - # Outputs the full name of a temporary file in the specified path. - function get-tempname($path) { - do { - $tempname = join-path $path ([IO.Path]::GetRandomFilename()) - } - while (test-path $tempname) - $tempname - } - - # Use '\r$' instead of '$' unless -UnixText specified because - # '$' alone matches '\n', not '\r\n'. Ignore '\$' (literal '$'). - if (-not $UnixText) { - $Pattern = $Pattern -replace '(? /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Properties/AssemblyInfo.cs b/UnitTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 709d556..0000000 --- a/UnitTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -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("UnitTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2011")] -[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("444775cc-f665-47a8-8779-b0ccb3aae338")] - -// 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.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/UnitTests/Seterlund.CodeGuard.UnitTests.csproj b/UnitTests/Seterlund.CodeGuard.UnitTests.csproj index dc131cd..ca6d432 100644 --- a/UnitTests/Seterlund.CodeGuard.UnitTests.csproj +++ b/UnitTests/Seterlund.CodeGuard.UnitTests.csproj @@ -1,134 +1,25 @@ - - + + - Debug - AnyCPU - - - 2.0 - {B7F516F7-E137-4922-B119-C87FFCDA8BBB} - Library - Properties - Seterlund.CodeGuard.UnitTests - Seterlund.CodeGuard.UnitTests - v4.5 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 1 - + netcoreapp2.0 + + false + + UnitTests - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - False - False - True - False - False - False - True - True - True - True - False - True - True - True - False - True - True - True - True - False - False - True - True - False - True - True - True - False - False - - - - - - - - True - False - False - True - Full - %28none%29 - 0 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True - - - - 3.5 - - - - - False - - + - - - - - - - - - - - - - - - - - - + + + + - - {534D625B-C310-4A98-8E05-1806E7AE389F} - Seterlund.CodeGuard - + + - + - - - \ No newline at end of file + + diff --git a/UnitTests/ValidateTests.cs b/UnitTests/ValidateTests.cs index 24f5b76..3fa106b 100644 --- a/UnitTests/ValidateTests.cs +++ b/UnitTests/ValidateTests.cs @@ -13,7 +13,7 @@ public class ValidateTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -22,7 +22,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/BooleanValidatorTests.cs b/UnitTests/Validators/BooleanValidatorTests.cs index 213a484..b45715d 100644 --- a/UnitTests/Validators/BooleanValidatorTests.cs +++ b/UnitTests/Validators/BooleanValidatorTests.cs @@ -12,7 +12,7 @@ public class BooleanValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/ClassValidatorTests.cs b/UnitTests/Validators/ClassValidatorTests.cs index 4a4ccab..b1ded16 100644 --- a/UnitTests/Validators/ClassValidatorTests.cs +++ b/UnitTests/Validators/ClassValidatorTests.cs @@ -12,7 +12,7 @@ public class ClassValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/ComparableValidatorTests.cs b/UnitTests/Validators/ComparableValidatorTests.cs index 77d589f..c3adbd0 100644 --- a/UnitTests/Validators/ComparableValidatorTests.cs +++ b/UnitTests/Validators/ComparableValidatorTests.cs @@ -12,7 +12,7 @@ public class ComparableValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/ComplexExpressionTests.cs b/UnitTests/Validators/ComplexExpressionTests.cs index 6023691..1fa9f2d 100644 --- a/UnitTests/Validators/ComplexExpressionTests.cs +++ b/UnitTests/Validators/ComplexExpressionTests.cs @@ -12,7 +12,7 @@ public class ComplexExpressionTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/EnumValidatorTests.cs b/UnitTests/Validators/EnumValidatorTests.cs index 0b84534..7860099 100644 --- a/UnitTests/Validators/EnumValidatorTests.cs +++ b/UnitTests/Validators/EnumValidatorTests.cs @@ -12,7 +12,7 @@ public class EnumValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/EnumerableValidatorTests.cs b/UnitTests/Validators/EnumerableValidatorTests.cs index 804174a..a93caaa 100644 --- a/UnitTests/Validators/EnumerableValidatorTests.cs +++ b/UnitTests/Validators/EnumerableValidatorTests.cs @@ -13,7 +13,7 @@ public class EnumerableValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -22,7 +22,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/GuidValidatorTests.cs b/UnitTests/Validators/GuidValidatorTests.cs index 3b09c3d..f58aa0d 100644 --- a/UnitTests/Validators/GuidValidatorTests.cs +++ b/UnitTests/Validators/GuidValidatorTests.cs @@ -12,7 +12,7 @@ public class GuidValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/IntegerValidatorTests.cs b/UnitTests/Validators/IntegerValidatorTests.cs index 30936bc..5d2fae2 100644 --- a/UnitTests/Validators/IntegerValidatorTests.cs +++ b/UnitTests/Validators/IntegerValidatorTests.cs @@ -12,7 +12,7 @@ public class IntegerValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/NullableValidatorTests.cs b/UnitTests/Validators/NullableValidatorTests.cs index aead5ef..82ac6f6 100644 --- a/UnitTests/Validators/NullableValidatorTests.cs +++ b/UnitTests/Validators/NullableValidatorTests.cs @@ -12,7 +12,7 @@ public class NullableValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/ObjectValidatorTests.cs b/UnitTests/Validators/ObjectValidatorTests.cs index dcfe945..bed1fb6 100644 --- a/UnitTests/Validators/ObjectValidatorTests.cs +++ b/UnitTests/Validators/ObjectValidatorTests.cs @@ -12,7 +12,7 @@ public class ObjectValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/Validators/StringValidatorTests.cs b/UnitTests/Validators/StringValidatorTests.cs index 75c2e30..53be8f4 100644 --- a/UnitTests/Validators/StringValidatorTests.cs +++ b/UnitTests/Validators/StringValidatorTests.cs @@ -12,7 +12,7 @@ public class StringValidatorTests : BaseTests /// /// Called once before first test is executed /// - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Init tests @@ -21,7 +21,7 @@ public void Init() /// /// Called once after last test is executed /// - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { // Cleanup tests diff --git a/UnitTests/packages.config b/UnitTests/packages.config deleted file mode 100644 index c714ef3..0000000 --- a/UnitTests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/NuGet.CommandLine.2.8.6/NuGet.CommandLine.2.8.6.nupkg b/packages/NuGet.CommandLine.2.8.6/NuGet.CommandLine.2.8.6.nupkg deleted file mode 100644 index b48321a..0000000 Binary files a/packages/NuGet.CommandLine.2.8.6/NuGet.CommandLine.2.8.6.nupkg and /dev/null differ diff --git a/packages/NuGet.CommandLine.2.8.6/tools/NuGet.exe b/packages/NuGet.CommandLine.2.8.6/tools/NuGet.exe deleted file mode 100644 index 324daa8..0000000 Binary files a/packages/NuGet.CommandLine.2.8.6/tools/NuGet.exe and /dev/null differ diff --git a/packages/repositories.config b/packages/repositories.config deleted file mode 100644 index d1efe2d..0000000 --- a/packages/repositories.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file