diff --git a/StevenVolckaert.EnterpriseLibrary.sln b/StevenVolckaert.EnterpriseLibrary.sln
index 9559677..8d9694f 100644
--- a/StevenVolckaert.EnterpriseLibrary.sln
+++ b/StevenVolckaert.EnterpriseLibrary.sln
@@ -1,46 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "StevenVolckaert.Core", "src\StevenVolckaert.Core\StevenVolckaert.Core.xproj", "{3E5DE170-18C8-4B09-90A6-7D158A6C54C5}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution items", "{00269925-9ABB-475F-A63B-B57C55E26CD3}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor.yml = appveyor.yml
- global.json = global.json
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{887100A5-003F-4148-85D8-9D9C9E7E5125}"
EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "StevenVolckaert.Core.Tests", "test\StevenVolckaert.Core.Tests\StevenVolckaert.Core.Tests.xproj", "{A97F5579-7D70-4FD4-8D6B-DC12E4909AD2}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{54EC9438-05ED-4ACD-AEF6-B31B353069EA}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StevenVolckaert.Core", "src\StevenVolckaert.Core\StevenVolckaert.Core.csproj", "{9493EB60-BD91-426A-BDF1-4390456046E1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StevenVolckaert.Core.Tests", "test\StevenVolckaert.Core.Tests\StevenVolckaert.Core.Tests.csproj", "{B2222404-4375-458C-9F04-C5F1D279CBA6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3E5DE170-18C8-4B09-90A6-7D158A6C54C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3E5DE170-18C8-4B09-90A6-7D158A6C54C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3E5DE170-18C8-4B09-90A6-7D158A6C54C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3E5DE170-18C8-4B09-90A6-7D158A6C54C5}.Release|Any CPU.Build.0 = Release|Any CPU
- {A97F5579-7D70-4FD4-8D6B-DC12E4909AD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A97F5579-7D70-4FD4-8D6B-DC12E4909AD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A97F5579-7D70-4FD4-8D6B-DC12E4909AD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A97F5579-7D70-4FD4-8D6B-DC12E4909AD2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9493EB60-BD91-426A-BDF1-4390456046E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9493EB60-BD91-426A-BDF1-4390456046E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9493EB60-BD91-426A-BDF1-4390456046E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9493EB60-BD91-426A-BDF1-4390456046E1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B2222404-4375-458C-9F04-C5F1D279CBA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B2222404-4375-458C-9F04-C5F1D279CBA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B2222404-4375-458C-9F04-C5F1D279CBA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B2222404-4375-458C-9F04-C5F1D279CBA6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
- {3E5DE170-18C8-4B09-90A6-7D158A6C54C5} = {54EC9438-05ED-4ACD-AEF6-B31B353069EA}
- {A97F5579-7D70-4FD4-8D6B-DC12E4909AD2} = {887100A5-003F-4148-85D8-9D9C9E7E5125}
+ {9493EB60-BD91-426A-BDF1-4390456046E1} = {54EC9438-05ED-4ACD-AEF6-B31B353069EA}
+ {B2222404-4375-458C-9F04-C5F1D279CBA6} = {887100A5-003F-4148-85D8-9D9C9E7E5125}
EndGlobalSection
EndGlobal
diff --git a/appveyor.yml b/appveyor.yml
index 26c76a1..0f25904 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 1.0.0-{build}
+version: 1.1.0-{build}
build:
verbosity: minimal
configuration:
@@ -6,14 +6,15 @@ configuration:
- Release
platform: Any CPU
environment:
+ image: Visual Studio 2017
DOTNET_CLI_TELEMETRY_OPTOUT: 1
init:
-- ps: $Env:LABEL = "CI" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0")
+- ps: $Env:VERSION_SUFFIX = "CI" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0")
before_build:
- appveyor-retry dotnet restore -v Minimal
build_script:
-- dotnet build "src\StevenVolckaert.Core" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
+- dotnet build "src\StevenVolckaert.Core" -c %CONFIGURATION% --version-suffix %VERSION_SUFFIX%
test_script:
-- dotnet test "test\StevenVolckaert.Core.Tests" -c %CONFIGURATION%
+- dotnet test "test\StevenVolckaert.Core.Tests\StevenVolckaert.Core.Tests.csproj" -c %CONFIGURATION%
cache:
- '%USERPROFILE%\.nuget\packages'
diff --git a/global.json b/global.json
deleted file mode 100644
index 9a66d5e..0000000
--- a/global.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "projects": [ "src", "test" ]
-}
diff --git a/src/StevenVolckaert.Core/ICollectionExtensions.cs b/src/StevenVolckaert.Core/ICollectionExtensions.cs
index 6a804fd..b0ce69b 100644
--- a/src/StevenVolckaert.Core/ICollectionExtensions.cs
+++ b/src/StevenVolckaert.Core/ICollectionExtensions.cs
@@ -5,7 +5,8 @@
using System.Linq;
///
- /// Provides extension methods for instances that implement the interface.
+ /// Provides extension methods for instances that implement the
+ /// interface.
///
public static class ICollectionExtensions
{
@@ -27,8 +28,40 @@ IEnumerable sourceCollection
if (source == null)
throw new ArgumentNullException(nameof(source));
- if (sourceCollection != null)
- foreach (TSource value in sourceCollection)
+ source.AddRange(sourceCollection, isDistinct: false);
+ }
+
+ ///
+ /// Adds the elements of the specified collection to the end of the
+ /// instance.
+ ///
+ /// The type of elements of .
+ /// The target data collection.
+ ///
+ /// A value that indicates whether to skip adding elements from
+ /// that already contains,
+ /// using the default equality comparer.
+ ///
+ ///
+ /// The collection whose elements should be added to the instance.
+ ///
+ /// is null.
+ public static void AddRange(
+ this ICollection source,
+ IEnumerable sourceCollection,
+ bool isDistinct
+ )
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ if (sourceCollection == null)
+ return;
+
+ foreach (TSource value in sourceCollection)
+ if (isDistinct && source.Contains(value))
+ continue;
+ else
source.Add(value);
}
@@ -42,7 +75,10 @@ IEnumerable sourceCollection
///
/// or is null.
///
- public static void RemoveFirst(this ICollection source, Func predicate)
+ public static void RemoveFirst(
+ this ICollection source,
+ Func predicate
+ )
{
if (source == null)
throw new ArgumentNullException(nameof(source));
diff --git a/src/StevenVolckaert.Core/IDictionaryExtensions.cs b/src/StevenVolckaert.Core/IDictionaryExtensions.cs
index f78514f..da46fb9 100644
--- a/src/StevenVolckaert.Core/IDictionaryExtensions.cs
+++ b/src/StevenVolckaert.Core/IDictionaryExtensions.cs
@@ -7,8 +7,8 @@
#endif
///
- /// Provides extension methods for instances that implement the
- /// interface.
+ /// Provides extension methods for instances that implement the
+ /// interface.
///
public static class IDictionaryExtensions
{
@@ -34,8 +34,8 @@ this IDictionary dictionary
#endif
///
- /// Gets the value associated with the specified key, or the type's default value if the key
- /// doesn't exist.
+ /// Gets the value associated with the specified key,
+ /// or the type's default value if the key doesn't exist.
///
/// The type of keys in the dictionary.
/// The type of values in the dictionary.
@@ -55,11 +55,12 @@ public static TValue TryGetValue(this IDictionary di
if (key == null)
throw new ArgumentNullException(nameof(key));
- return dictionary.TryGetValue(key, defaultValue: default(TValue));
+ return dictionary.TryGetValue(key, fallbackValue: default(TValue));
}
///
- /// Gets the value associated with the specified key, or a default value if the key doesn't exist.
+ /// Gets the value associated with the specified key,
+ /// or a specified fallback value if the key doesn't exist.
///
/// The type of keys in the dictionary.
/// The type of values in the dictionary.
@@ -67,15 +68,15 @@ public static TValue TryGetValue(this IDictionary di
/// The instance this extension method affects.
///
/// The key whose value to get.
- /// The default value.
+ /// The default value.
///
- /// The value associated with the specified key, or if
+ /// The value associated with the specified key, or if
/// doesn't exist.
///
public static TValue TryGetValue(
this IDictionary dictionary,
TKey key,
- TValue defaultValue
+ TValue fallbackValue
)
{
if (dictionary == null)
@@ -84,7 +85,7 @@ TValue defaultValue
if (key == null)
throw new ArgumentNullException(nameof(key));
- return dictionary.ContainsKey(key) ? dictionary[key] : defaultValue;
+ return dictionary.ContainsKey(key) ? dictionary[key] : fallbackValue;
}
}
}
diff --git a/src/StevenVolckaert.Core/IEnumerableExtensions.cs b/src/StevenVolckaert.Core/IEnumerableExtensions.cs
index 04e817c..31dfb48 100644
--- a/src/StevenVolckaert.Core/IEnumerableExtensions.cs
+++ b/src/StevenVolckaert.Core/IEnumerableExtensions.cs
@@ -8,17 +8,90 @@
#endif
///
- /// Provides extension methods for instances that implement the interface.
+ /// Provides extension methods for instances that implement the
+ /// interface.
///
public static class IEnumerableExtensions
{
+ ///
+ /// Adds a specified element to the end of the sequence.
+ ///
+ /// The type of the elements of .
+ ///
+ /// The instance this extension method affects.
+ ///
+ /// The element to add.
+ ///
+ /// An instance containing all elements of ,
+ /// followed by .
+ ///
+ ///
+ /// is null.
+ ///
+ public static IEnumerable Append(this IEnumerable source, T element)
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ foreach (var sourceElement in source)
+ yield return sourceElement;
+
+ yield return element;
+ }
+
+ ///
+ /// Adds a specified element to the beginning of the sequence.
+ ///
+ /// The type of the elements of .
+ ///
+ /// The instance this extenion method affects.
+ ///
+ /// The element to add.
+ ///
+ /// An instance containing ,
+ /// followed by all elements of .
+ ///
+ ///
+ /// is null.
+ ///
+ public static IEnumerable Prepend(this IEnumerable source, T element)
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ yield return element;
+
+ foreach (var sourceElement in source)
+ yield return sourceElement;
+ }
+
+ ///
+ /// Determines whether a sequence contains no elements.
+ ///
+ /// The type of the elements of .
+ /// The instance to check for emptiness.
+ ///
+ /// true if the source sequence contains no elements; otherwise, false.
+ ///
+ /// is null.
+ public static bool IsEmpty(this IEnumerable source)
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ return !source.Any();
+ }
+
///
/// Determines whether a sequence contains no elements.
///
/// The type of the elements of .
/// The instance to check for emptiness.
- /// true if the source sequence contains no elements; otherwise, false.
+ ///
+ /// true if the source sequence contains no elements; otherwise, false.
+ ///
/// is null.
+ [Obsolete("Use of this method is deprecated. Use IEnumerable.IsEmpty() instead.")]
public static bool Empty(this IEnumerable source)
{
if (source == null)
@@ -253,8 +326,8 @@ public static IEnumerable SkipLast(this IEnumerable source)
/// The sequence to remove elements from.
/// The number of elements to remove.
///
- /// An instance that doesn't contain the specified number of elements at
- /// the end of the input sequence.
+ /// An instance that doesn't contain the specified number of elements
+ /// at the end of the input sequence.
///
///
/// is null.
@@ -285,7 +358,8 @@ public static IEnumerable SkipLast(this IEnumerable source, int count)
/// The type of the elements of .
/// The sequence to create an from.
///
- /// An instance that contains elements from the input sequence.
+ /// An instance that contains elements from the input
+ /// sequence.
///
///
/// is null.
diff --git a/src/StevenVolckaert.Core/Properties/AssemblyInfo.cs b/src/StevenVolckaert.Core/Properties/AssemblyInfo.cs
deleted file mode 100644
index 78bab0d..0000000
--- a/src/StevenVolckaert.Core/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Release")]
-#endif
-
-[assembly: AssemblyCompany("Steven Volckaert")]
-[assembly: AssemblyProduct("StevenVolckaert.Core")]
-[assembly: AssemblyTrademark("")]
-
-[assembly: ComVisible(false)]
-[assembly: Guid("3e5de170-18c8-4b09-90a6-7d158a6c54c5")]
diff --git a/src/StevenVolckaert.Core/StevenVolckaert.Core.csproj b/src/StevenVolckaert.Core/StevenVolckaert.Core.csproj
new file mode 100644
index 0000000..945dc9c
--- /dev/null
+++ b/src/StevenVolckaert.Core/StevenVolckaert.Core.csproj
@@ -0,0 +1,40 @@
+
+
+
+ StevenVolckaert.Core
+ Steven Volckaert's Enterprise Library - Core
+ en-US
+ 1.0.1
+ alpha
+ Copyright (c) 2016, 2017 Steven Volckaert
+ Steven Volckaert's Enterprise Library contains reusable software components designed to assist software developers with writing less and semantically more meaningful code.
+
+See https://github.com/stevenvolckaert/enterprise-library for more information.
+ Steven Volckaert
+ net452;netstandard1.5
+ true
+ StevenVolckaert.Core
+ https://github.com/stevenvolckaert/enterprise-library
+ https://github.com/stevenvolckaert/enterprise-library/blob/master/LICENSE
+ git
+ https://github.com/stevenvolckaert/enterprise-library
+ 1.6.1
+ false
+ false
+ false
+ StevenVolckaert
+ 1.1.0.0
+ 1.1.0.0
+ 1.1.0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/StevenVolckaert.Core/StevenVolckaert.Core.xproj b/src/StevenVolckaert.Core/StevenVolckaert.Core.xproj
deleted file mode 100644
index 6e51fd5..0000000
--- a/src/StevenVolckaert.Core/StevenVolckaert.Core.xproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- 14.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- 3e5de170-18c8-4b09-90a6-7d158a6c54c5
- StevenVolckaert
- .\obj
- .\bin\
- v4.5.2
-
-
- 2.0
-
-
-
\ No newline at end of file
diff --git a/src/StevenVolckaert.Core/StringExtensions.cs b/src/StevenVolckaert.Core/StringExtensions.cs
index 8edda45..a36154d 100644
--- a/src/StevenVolckaert.Core/StringExtensions.cs
+++ b/src/StevenVolckaert.Core/StringExtensions.cs
@@ -57,9 +57,23 @@ public static bool IsNullOrWhiteSpace(this string value)
///
/// The string, or the default value if the string is null or empty.
///
+ [Obsolete("Use of this method is deprecated. Use string.FallbackIfNullOrEmpty(string) instead.")]
public static string DefaultIfNullOrEmpty(this string value, string defaultValue)
{
- return string.IsNullOrEmpty(value) ? defaultValue : value;
+ return value.FallbackIfNullOrWhiteSpace(defaultValue);
+ }
+
+ ///
+ /// Returns the string, or a specified fallback value if the string is null or empty.
+ ///
+ /// The value this extension method affects.
+ /// The default value.
+ ///
+ /// The string, or if the string is null or empty.
+ ///
+ public static string FallbackIfNullOrEmpty(this string value, string fallbackValue)
+ {
+ return string.IsNullOrEmpty(value) ? fallbackValue : value;
}
///
@@ -70,9 +84,25 @@ public static string DefaultIfNullOrEmpty(this string value, string defaultValue
///
/// The string, or the default value if the string is null, empty, or white space.
///
+ [Obsolete("Use of this method is deprecated. Use string.FallbackIfNullOrWhiteSpace(string) instead.")]
public static string DefaultIfNullOrWhiteSpace(this string value, string defaultValue)
{
- return value.IsNullOrWhiteSpace() ? defaultValue : value;
+ return value.FallbackIfNullOrWhiteSpace(defaultValue);
+ }
+
+ ///
+ /// Returns the string,
+ /// or a specified fallback value if the string is null, empty, or white space.
+ ///
+ /// The value this extension method affects.
+ /// The default value.
+ ///
+ /// The string, or if the string is null, empty,
+ /// or white space.
+ ///
+ public static string FallbackIfNullOrWhiteSpace(this string value, string fallbackValue)
+ {
+ return value.IsNullOrWhiteSpace() ? fallbackValue : value;
}
///
@@ -89,8 +119,7 @@ public static string FirstFromSplit(this string value, params string[] separator
if (string.IsNullOrEmpty(value))
return null;
- var values = value.Split(separators, StringSplitOptions.RemoveEmptyEntries).ToList();
- return values.FirstOrDefault();
+ return value.Split(separators, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
}
///
diff --git a/src/StevenVolckaert.Core/UnitConvert.cs b/src/StevenVolckaert.Core/UnitConvert.cs
index a067203..1bad77d 100644
--- a/src/StevenVolckaert.Core/UnitConvert.cs
+++ b/src/StevenVolckaert.Core/UnitConvert.cs
@@ -7,7 +7,21 @@
///
public static class UnitConvert
{
- private const double FeetPerMeter = 3.280839895;
+ private const double MillimetersPerInch = 25.4;
+ private const double MillimetersPerFoot = MillimetersPerInch * 12;
+ private const double MillimetersPerYard = MillimetersPerFoot * 3;
+
+ ///
+ /// The millimeters per DTP point. The DTP is defined as 1⁄72 of an international inch
+ /// (exactly 25.4 mm).
+ ///
+ ///
+ /// See https://en.wikipedia.org/wiki/Point_(typography) for more information.
+ ///
+ private const double MillimetersPerPoint = MillimetersPerInch / 72;
+
+ private const double MetersPerFoot = MillimetersPerFoot / 1000;
+ private const double MetersPerYard = MillimetersPerYard / 1000;
///
/// Converts a value in degrees Celsius (°C) to its equivalent in degrees Fahrenheit (°F).
@@ -52,43 +66,83 @@ public static int FromFahrenheitToCelsius(double value)
}
///
- /// Converts a value in feet to its equivalent in meter.
+ /// Converts a value in feet to its equivalent in meters.
+ ///
+ /// The value to convert.
+ /// The value in meters.
+ public static double FromFeetToMeters(int value)
+ {
+ return FromFeetToMeters((double)value);
+ }
+
+ ///
+ /// Converts a value in feet to its equivalent in meters.
///
/// The value to convert.
- /// The value in meter.
- public static double FromFeetToMeter(int value)
+ /// The value in meters.
+ public static double FromFeetToMeters(double value)
{
- return FromFeetToMeter((double)value);
+ return value * MetersPerFoot;
}
///
- /// Converts a value in feet to its equivalent in meter.
+ /// Converts a value in international inches to its equivalent in millimeters.
///
/// The value to convert.
- /// The value in meter.
- public static double FromFeetToMeter(double value)
+ /// The value in millimeters.
+ public static double FromInchesToMillimeters(double value)
{
- return value / FeetPerMeter;
+ return value * MillimetersPerInch;
}
///
- /// Converts a value in meter to its equivalent in feet.
+ /// Converts a value in meters to its equivalent in feet.
///
/// The value to convert.
/// The value in feet.
- public static double FromMeterToFeet(int value)
+ public static double FromMetersToFeet(int value)
{
- return FromMeterToFeet((double)value);
+ return FromMetersToFeet((double)value);
}
///
- /// Converts a value in meter to its equivalent in feet.
+ /// Converts a value in meters to its equivalent in feet.
///
/// The value to convert.
/// The value in feet.
- public static double FromMeterToFeet(double value)
+ public static double FromMetersToFeet(double value)
+ {
+ return value / MetersPerFoot;
+ }
+
+ ///
+ /// Converts a value in millimeters to its equivalent in international inches.
+ ///
+ /// The value to convert.
+ /// The value in international inches.
+ public static double FromMillimetersToInches(double value)
+ {
+ return value / MillimetersPerInch;
+ }
+
+ ///
+ /// Converts a value in millimeters to its equivalent in DTPs (Desktop Publishing Points).
+ ///
+ /// The value to convert.
+ /// The value in DTPs (Desktop Publishing Points).
+ public static double FromMillimetersToPoints(double value)
+ {
+ return value / MillimetersPerPoint;
+ }
+
+ ///
+ /// Converts a value in DTPs (Desktop Publishing Points) to its equivalent in millimeters.
+ ///
+ /// The value to convert.
+ /// The value in millimeters.
+ public static double FromPointsToMillimeters(double value)
{
- return value * FeetPerMeter;
+ return value * MillimetersPerPoint;
}
}
}
diff --git a/src/StevenVolckaert.Core/project.json b/src/StevenVolckaert.Core/project.json
deleted file mode 100644
index 5bcd835..0000000
--- a/src/StevenVolckaert.Core/project.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "title": "Steven Volckaert's Enterprise Library - Core",
- "copyright": "Copyright (c) 2016 Steven Volckaert",
- "description": "Steven Volckaert's Enterprise Library contains reusable software components designed to assist software developers with writing less and semantically more meaningful code.\n\nSee https://github.com/stevenvolckaert/enterprise-library for more information.",
- "language": "en-US",
- "version": "1.0.0-*",
- "authors": [ "Steven Volckaert" ],
- "frameworks": {
- "net35": {},
- "net452": {},
- "netstandard1.5": {
- "dependencies": {
- "NETStandard.Library": "1.6.1"
- }
- }
- },
- "buildOptions": {
- "xmlDoc": true
- },
- "packOptions": {
- "projectUrl": "https://github.com/stevenvolckaert/enterprise-library",
- "repository": {
- "type": "git",
- "url": "https://github.com/stevenvolckaert/enterprise-library"
- },
- "licenseUrl": "https://github.com/stevenvolckaert/enterprise-library/blob/master/LICENSE",
- "requireLicenseAcceptance": false
- }
-}
diff --git a/test/StevenVolckaert.Core.Tests/ICollectionExtensionsTests.cs b/test/StevenVolckaert.Core.Tests/ICollectionExtensionsTests.cs
new file mode 100644
index 0000000..c0053ac
--- /dev/null
+++ b/test/StevenVolckaert.Core.Tests/ICollectionExtensionsTests.cs
@@ -0,0 +1,45 @@
+namespace StevenVolckaert.Tests
+{
+ using System.Collections.Generic;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+ [TestClass]
+ public class ICollectionExtensionsTests
+ {
+ [TestMethod]
+ public void AddRangeTest()
+ {
+ var source = new List { "foo", "bar", "baz" };
+ var other = new List { "bar", "foo", "qux" };
+ var expected = new List { "foo", "bar", "baz", "bar", "foo", "qux" };
+
+ source.AddRange(other);
+
+ CollectionAssert.AreEqual(expected, source);
+ }
+
+ [TestMethod]
+ public void AddRangeIndistinctTest()
+ {
+ var source = new List { "foo", "bar", "baz" };
+ var other = new List { "bar", "foo", "qux" };
+ var expected = new List { "foo", "bar", "baz", "bar", "foo", "qux" };
+
+ source.AddRange(other, isDistinct: false);
+
+ CollectionAssert.AreEqual(expected, source);
+ }
+
+ [TestMethod]
+ public void AddRangeDistinctTest()
+ {
+ var source = new List { "foo", "bar", "baz" };
+ var other = new List { "bar", "foo", "qux" };
+ var expected = new List { "foo", "bar", "baz", "qux" };
+
+ source.AddRange(other, isDistinct: true);
+
+ CollectionAssert.AreEqual(expected, source);
+ }
+ }
+}
diff --git a/test/StevenVolckaert.Core.Tests/IEnumerableExtensionsTests.cs b/test/StevenVolckaert.Core.Tests/IEnumerableExtensionsTests.cs
index 596aa04..671e4b0 100644
--- a/test/StevenVolckaert.Core.Tests/IEnumerableExtensionsTests.cs
+++ b/test/StevenVolckaert.Core.Tests/IEnumerableExtensionsTests.cs
@@ -1,12 +1,32 @@
namespace StevenVolckaert.Tests
{
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class IEnumerableExtensionsTests
{
+ [TestMethod]
+ public void AppendTest()
+ {
+ var source = new string[] { "foo", "bar" };
+ var expected = new string[] { "foo", "bar", "baz" };
+ var actual = source.Append("baz").ToArray();
+
+ CollectionAssert.AreEqual(expected, actual);
+ }
+
+ [TestMethod]
+ public void PrependTest()
+ {
+ var source = new string[] { "bar", "baz" };
+ var expected = new string[] { "foo", "bar", "baz" };
+ var actual = source.Prepend("foo").ToArray();
+
+ CollectionAssert.AreEqual(expected, actual);
+ }
+
[TestMethod]
public void ExceptTest()
{
diff --git a/test/StevenVolckaert.Core.Tests/Properties/AssemblyInfo.cs b/test/StevenVolckaert.Core.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8a72bfd..0000000
--- a/test/StevenVolckaert.Core.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Release")]
-#endif
-
-[assembly: AssemblyCompany("Steven Volckaert")]
-[assembly: AssemblyProduct("StevenVolckaert.Core.Tests")]
-[assembly: AssemblyTrademark("")]
-
-[assembly: ComVisible(false)]
-[assembly: Guid("a97f5579-7d70-4fd4-8d6b-dc12e4909ad2")]
diff --git a/test/StevenVolckaert.Core.Tests/StevenVolckaert.Core.Tests.csproj b/test/StevenVolckaert.Core.Tests/StevenVolckaert.Core.Tests.csproj
new file mode 100644
index 0000000..ec8e296
--- /dev/null
+++ b/test/StevenVolckaert.Core.Tests/StevenVolckaert.Core.Tests.csproj
@@ -0,0 +1,23 @@
+
+
+
+ netcoreapp1.1
+ StevenVolckaert.Tests
+ 1.1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/StevenVolckaert.Core.Tests/StevenVolckaert.Core.Tests.xproj b/test/StevenVolckaert.Core.Tests/StevenVolckaert.Core.Tests.xproj
deleted file mode 100644
index ec4bd4e..0000000
--- a/test/StevenVolckaert.Core.Tests/StevenVolckaert.Core.Tests.xproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- 14.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
-
-
-
- a97f5579-7d70-4fd4-8d6b-dc12e4909ad2
- StevenVolckaert.Tests
- .\obj
- .\bin\
- v4.5.2
-
-
- 2.0
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/StevenVolckaert.Core.Tests/UnitConvertTests.cs b/test/StevenVolckaert.Core.Tests/UnitConvertTests.cs
index a9e3db9..8fbb1b7 100644
--- a/test/StevenVolckaert.Core.Tests/UnitConvertTests.cs
+++ b/test/StevenVolckaert.Core.Tests/UnitConvertTests.cs
@@ -8,50 +8,50 @@
public class UnitConvertTests
{
///
- /// A list of tuples that links degrees Celsius to degrees Fahrenheit.
- /// Source http://www.rapidtables.com/convert/temperature/celsius-to-fahrenheit.htm
+ /// A list of tuples that links degrees Celsius to degrees Fahrenheit.
+ /// Source http://www.rapidtables.com/convert/temperature/celsius-to-fahrenheit.htm
///
private static readonly List> _temperatureTuples =
new List>
{
- new Tuple(-50, -58),
- new Tuple(-40, -40),
- new Tuple(-30, -22),
- new Tuple(-20, -4),
- new Tuple(-10, 14),
- new Tuple(-9, 16),
- new Tuple(-8, 18),
- new Tuple(-7, 19),
- new Tuple(-6, 21),
- new Tuple(-5, 23),
- new Tuple(-4, 25),
- new Tuple(-3, 27),
- new Tuple(-2, 28),
- new Tuple(-1, 30),
- new Tuple(0, 32),
- new Tuple(1, 34),
- new Tuple(2, 36),
- new Tuple(3, 37),
- new Tuple(4, 39),
- new Tuple(5, 41),
- new Tuple(6, 43),
- new Tuple(7, 45),
- new Tuple(8, 46),
- new Tuple(9, 48),
- new Tuple(10, 50),
- new Tuple(20, 68),
- new Tuple(21, 70),
- new Tuple(30, 86),
- new Tuple(37, 99),
- new Tuple(40, 104),
- new Tuple(50, 122),
- new Tuple(60, 140),
- new Tuple(70, 158),
- new Tuple(80, 176),
- new Tuple(90, 194),
- new Tuple(100, 212),
- new Tuple(200, 392),
- new Tuple(300, 572),
+ Tuple.Create(-50, -58),
+ Tuple.Create(-40, -40),
+ Tuple.Create(-30, -22),
+ Tuple.Create(-20, -4),
+ Tuple.Create(-10, 14),
+ Tuple.Create(-9, 16),
+ Tuple.Create(-8, 18),
+ Tuple.Create(-7, 19),
+ Tuple.Create(-6, 21),
+ Tuple.Create(-5, 23),
+ Tuple.Create(-4, 25),
+ Tuple.Create(-3, 27),
+ Tuple.Create(-2, 28),
+ Tuple.Create(-1, 30),
+ Tuple.Create(0, 32),
+ Tuple.Create(1, 34),
+ Tuple.Create(2, 36),
+ Tuple.Create(3, 37),
+ Tuple.Create(4, 39),
+ Tuple.Create(5, 41),
+ Tuple.Create(6, 43),
+ Tuple.Create(7, 45),
+ Tuple.Create(8, 46),
+ Tuple.Create(9, 48),
+ Tuple.Create(10, 50),
+ Tuple.Create(20, 68),
+ Tuple.Create(21, 70),
+ Tuple.Create(30, 86),
+ Tuple.Create(37, 99),
+ Tuple.Create(40, 104),
+ Tuple.Create(50, 122),
+ Tuple.Create(60, 140),
+ Tuple.Create(70, 158),
+ Tuple.Create(80, 176),
+ Tuple.Create(90, 194),
+ Tuple.Create(100, 212),
+ Tuple.Create(200, 392),
+ Tuple.Create(300, 572),
};
[TestMethod]
@@ -69,17 +69,5 @@ public void FromFahrenheitToCelsiusTest()
x => Assert.AreEqual(x.Item1, UnitConvert.FromFahrenheitToCelsius(x.Item2))
);
}
-
- //[TestMethod]
- public void FromFeetToMeterTest()
- {
- throw new NotImplementedException();
- }
-
- //[TestMethod]
- public void FromMeterToFeetTest()
- {
- throw new NotImplementedException();
- }
}
}
diff --git a/test/StevenVolckaert.Core.Tests/project.json b/test/StevenVolckaert.Core.Tests/project.json
deleted file mode 100644
index 4882276..0000000
--- a/test/StevenVolckaert.Core.Tests/project.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "title": "StevenVolckaert.Core.Tests",
- "copyright": "Copyright (c) 2016 Steven Volckaert",
- "description": "Unit test project for StevenVolckaert.Core.",
- "language": "en-US",
- "version": "1.0.0-*",
- "authors": [ "Steven Volckaert" ],
-
- "testRunner": "mstest",
-
- "dependencies": {
- "StevenVolckaert.Core": "0.1.1-*",
- "dotnet-test-mstest": "1.1.2-preview",
- "Microsoft.NETCore.App": {
- "version": "1.0.1",
- "type": "platform"
- },
- "MSTest.TestFramework": "1.0.7-preview"
- },
-
- "frameworks": {
- "netcoreapp1.0": {
- "imports": [
- "dnxcore50",
- "portable-net45+win8"
- ]
- }
- }
-}