Skip to content

Commit

Permalink
Merge pull request #12 from martinsmith1968/feature/use-automatic-ver…
Browse files Browse the repository at this point in the history
…sioning

Feature/use automatic versioning
  • Loading branch information
martinsmith1968 authored Jan 1, 2020
2 parents 1ea7e74 + f5da5a2 commit a623605
Show file tree
Hide file tree
Showing 32 changed files with 1,546 additions and 1,465 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# https://stackoverflow.com/questions/41509608/how-do-i-deploy-nuget-packages-in-travis-ci
# Builds: https://travis-ci.org/martinsmith1968/DNX.Helpers
#
# References:
# https://stackoverflow.com/questions/41509608/how-do-i-deploy-nuget-packages-in-travis-ci
# https://docs.travis-ci.com/user/languages/csharp/
# https://travis-ci.com/bilal-fazlani/commanddotnet/builds/142334958/config

Expand All @@ -18,7 +21,7 @@ mono: none

branches:
except:
- v*
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/

stages:
- name: build
Expand Down
8 changes: 6 additions & 2 deletions DNX.Helpers/DNX.Helpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
<PackageIconUrl>https://raw.githubusercontent.com/martinsmith1968/DNX.Helpers/master/images/favicon-32x32.png</PackageIconUrl>
<PackageTags>DNX helpers extensions string array linq</PackageTags>
<PackageReleaseNotes>Interpolation to a working version and some preparation for moving to .NET Standard</PackageReleaseNotes>
<Version>2.0.7</Version>
<AssemblyVersion>2.0.7</AssemblyVersion>
<Version>2.0.8</Version>
<AssemblyVersion>2.0.8</AssemblyVersion>
<FileVersion>2.0.8</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\DNX.Helpers.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Remove="Converters\BuiltInTypes\Build.cmd" />
Expand Down
10 changes: 10 additions & 0 deletions DNX.Helpers/Strings/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@

// ReSharper disable InvertIf
// ReSharper disable LoopCanBeConvertedToQuery

namespace DNX.Helpers.Strings
{
/// <summary>
/// How the delimiter is to be treated when splitting text
/// </summary>
public enum SplitDelimiterType
{
/// <summary>
/// Any specified value can be a delimiter
/// </summary>
Any = 0,

/// <summary>
/// All specified values are the delimiter
/// </summary>
All
}

Expand Down Expand Up @@ -463,7 +471,9 @@ public static string Reverse(this string text)
/// <param name="text">The text.</param>
/// <param name="delimiters">The delimiters.</param>
/// <param name="options">The options.</param>
/// <param name="delimiterType">Type of the delimiter.</param>
/// <returns>IEnumerable&lt;System.String&gt;.</returns>
/// <exception cref="ArgumentOutOfRangeException">delimiterType - Value must be one of {string.Join(",", Enum.GetNames(typeof(SplitDelimiterType)))}</exception>
/// <remarks>Also available as an extension method</remarks>
public static IEnumerable<string> SplitText(this string text, string delimiters, StringSplitOptions options = StringSplitOptions.None, SplitDelimiterType delimiterType = SplitDelimiterType.Any)
{
Expand Down
12 changes: 11 additions & 1 deletion GenerateMarkdown.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
@ECHO OFF

xd2md.exe DNX.Helpers\bin\Debug\DNX.Helpers.XML > reference\reference.md
SETLOCAL

PUSHD "%~dp0"

FOR %%* IN (.) DO SET CURRENTDIRNAME=%%~nx*

SET APPNAME=%CURRENTDIRNAME%

xd2md.exe %APPNAME%\bin\%APPNAME%.XML > reference\reference.md

POPD
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(byte value, byte min, byte max, bool allowEitherOrder, IsB
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsByteExtensionsTestsSource), "GetLowerBound")]
public byte GetLowerBound(byte min, byte max, bool allowEitherOrder)
{
return MathsByteExtensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsByteExtensionsTestsSource), "GetLowerBound")]
public byte GetLowerBound(byte min, byte max, bool allowEitherOrder)
{
return MathsByteExtensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsByteExtensionsTestsSource), "GetUpperBound")]
public byte GetUpperBound(byte min, byte max, bool allowEitherOrder)
{
return MathsByteExtensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsByteExtensionsTestsSource), "GetUpperBound")]
public byte GetUpperBound(byte min, byte max, bool allowEitherOrder)
{
return MathsByteExtensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(DateTime value, DateTime min, DateTime max, bool allowEith
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsDateTimeExtensionsTestsSource), "GetLowerBound")]
public DateTime GetLowerBound(DateTime min, DateTime max, bool allowEitherOrder)
{
return MathsDateTimeExtensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsDateTimeExtensionsTestsSource), "GetLowerBound")]
public DateTime GetLowerBound(DateTime min, DateTime max, bool allowEitherOrder)
{
return MathsDateTimeExtensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsDateTimeExtensionsTestsSource), "GetUpperBound")]
public DateTime GetUpperBound(DateTime min, DateTime max, bool allowEitherOrder)
{
return MathsDateTimeExtensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsDateTimeExtensionsTestsSource), "GetUpperBound")]
public DateTime GetUpperBound(DateTime min, DateTime max, bool allowEitherOrder)
{
return MathsDateTimeExtensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(decimal value, decimal min, decimal max, bool allowEitherO
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsDecimalExtensionsTestsSource), "GetLowerBound")]
public decimal GetLowerBound(decimal min, decimal max, bool allowEitherOrder)
{
return MathsDecimalExtensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsDecimalExtensionsTestsSource), "GetLowerBound")]
public decimal GetLowerBound(decimal min, decimal max, bool allowEitherOrder)
{
return MathsDecimalExtensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsDecimalExtensionsTestsSource), "GetUpperBound")]
public decimal GetUpperBound(decimal min, decimal max, bool allowEitherOrder)
{
return MathsDecimalExtensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsDecimalExtensionsTestsSource), "GetUpperBound")]
public decimal GetUpperBound(decimal min, decimal max, bool allowEitherOrder)
{
return MathsDecimalExtensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(double value, double min, double max, bool allowEitherOrde
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsDoubleExtensionsTestsSource), "GetLowerBound")]
public double GetLowerBound(double min, double max, bool allowEitherOrder)
{
return MathsDoubleExtensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsDoubleExtensionsTestsSource), "GetLowerBound")]
public double GetLowerBound(double min, double max, bool allowEitherOrder)
{
return MathsDoubleExtensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsDoubleExtensionsTestsSource), "GetUpperBound")]
public double GetUpperBound(double min, double max, bool allowEitherOrder)
{
return MathsDoubleExtensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsDoubleExtensionsTestsSource), "GetUpperBound")]
public double GetUpperBound(double min, double max, bool allowEitherOrder)
{
return MathsDoubleExtensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
52 changes: 26 additions & 26 deletions Test.DNX.Helpers/Maths/BuiltInTypes/MathsExtensionsTestsTemplate.tt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
<#
var types = new Dictionary<string, string>()
{
{ "Byte", "byte" },
{ "SByte", "sbyte" },
{ "Byte", "byte" },
{ "SByte", "sbyte" },

{ "DateTime", "DateTime" },
{ "DateTime", "DateTime" },

{ "Int16", "short" },
{ "UInt16", "ushort" },
{ "Int16", "short" },
{ "UInt16", "ushort" },

{ "Int32", "int" },
{ "UInt32", "uint" },
{ "Int32", "int" },
{ "UInt32", "uint" },

{ "Int64", "long" },
{ "UInt64", "ulong" },
{ "Int64", "long" },
{ "UInt64", "ulong" },

{ "Float", "float" },
{ "Double", "double" },
{ "Decimal", "decimal" },
{ "Float", "float" },
{ "Double", "double" },
{ "Decimal", "decimal" },
}; #>
<# manager.StartHeader(); #>
// Code generated by a Template
Expand All @@ -40,11 +40,11 @@ namespace Test.DNX.Helpers.Maths.BuiltInTypes
<#
foreach (var kvp in types)
{
var typeName = kvp.Value;
var typeDesc = kvp.Key;
var fileName = string.Format("Maths{0}ExtensionsTests.generated.cs", typeDesc);
var typeName = kvp.Value;
var typeDesc = kvp.Key;
var fileName = string.Format("Maths{0}ExtensionsTests.generated.cs", typeDesc);

manager.StartNewFile(fileName);
manager.StartNewFile(fileName);
#>
[TestFixture]
public class Maths<#= typeDesc #>ExtensionsTests
Expand Down Expand Up @@ -79,17 +79,17 @@ foreach (var kvp in types)
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(Maths<#= typeDesc #>ExtensionsTestsSource), "GetLowerBound")]
public <#= typeName #> GetLowerBound(<#= typeName #> min, <#= typeName #> max, bool allowEitherOrder)
{
return Maths<#= typeDesc #>Extensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(Maths<#= typeDesc #>ExtensionsTestsSource), "GetLowerBound")]
public <#= typeName #> GetLowerBound(<#= typeName #> min, <#= typeName #> max, bool allowEitherOrder)
{
return Maths<#= typeDesc #>Extensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(Maths<#= typeDesc #>ExtensionsTestsSource), "GetUpperBound")]
public <#= typeName #> GetUpperBound(<#= typeName #> min, <#= typeName #> max, bool allowEitherOrder)
{
return Maths<#= typeDesc #>Extensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(Maths<#= typeDesc #>ExtensionsTestsSource), "GetUpperBound")]
public <#= typeName #> GetUpperBound(<#= typeName #> min, <#= typeName #> max, bool allowEitherOrder)
{
return Maths<#= typeDesc #>Extensions.GetUpperBound(min, max, allowEitherOrder);
}
}
<# manager.EndBlock();
} #>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(float value, float min, float max, bool allowEitherOrder,
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsFloatExtensionsTestsSource), "GetLowerBound")]
public float GetLowerBound(float min, float max, bool allowEitherOrder)
{
return MathsFloatExtensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsFloatExtensionsTestsSource), "GetLowerBound")]
public float GetLowerBound(float min, float max, bool allowEitherOrder)
{
return MathsFloatExtensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsFloatExtensionsTestsSource), "GetUpperBound")]
public float GetUpperBound(float min, float max, bool allowEitherOrder)
{
return MathsFloatExtensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsFloatExtensionsTestsSource), "GetUpperBound")]
public float GetUpperBound(float min, float max, bool allowEitherOrder)
{
return MathsFloatExtensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(short value, short min, short max, bool allowEitherOrder,
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsInt16ExtensionsTestsSource), "GetLowerBound")]
public short GetLowerBound(short min, short max, bool allowEitherOrder)
{
return MathsInt16Extensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsInt16ExtensionsTestsSource), "GetLowerBound")]
public short GetLowerBound(short min, short max, bool allowEitherOrder)
{
return MathsInt16Extensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsInt16ExtensionsTestsSource), "GetUpperBound")]
public short GetUpperBound(short min, short max, bool allowEitherOrder)
{
return MathsInt16Extensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsInt16ExtensionsTestsSource), "GetUpperBound")]
public short GetUpperBound(short min, short max, bool allowEitherOrder)
{
return MathsInt16Extensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(int value, int min, int max, bool allowEitherOrder, IsBetw
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsInt32ExtensionsTestsSource), "GetLowerBound")]
public int GetLowerBound(int min, int max, bool allowEitherOrder)
{
return MathsInt32Extensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsInt32ExtensionsTestsSource), "GetLowerBound")]
public int GetLowerBound(int min, int max, bool allowEitherOrder)
{
return MathsInt32Extensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsInt32ExtensionsTestsSource), "GetUpperBound")]
public int GetUpperBound(int min, int max, bool allowEitherOrder)
{
return MathsInt32Extensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsInt32ExtensionsTestsSource), "GetUpperBound")]
public int GetUpperBound(int min, int max, bool allowEitherOrder)
{
return MathsInt32Extensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ public bool IsBetween(long value, long min, long max, bool allowEitherOrder, IsB
return value.IsBetween(min, max, allowEitherOrder, boundsType);
}

[TestCaseSource(typeof(MathsInt64ExtensionsTestsSource), "GetLowerBound")]
public long GetLowerBound(long min, long max, bool allowEitherOrder)
{
return MathsInt64Extensions.GetLowerBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsInt64ExtensionsTestsSource), "GetLowerBound")]
public long GetLowerBound(long min, long max, bool allowEitherOrder)
{
return MathsInt64Extensions.GetLowerBound(min, max, allowEitherOrder);
}

[TestCaseSource(typeof(MathsInt64ExtensionsTestsSource), "GetUpperBound")]
public long GetUpperBound(long min, long max, bool allowEitherOrder)
{
return MathsInt64Extensions.GetUpperBound(min, max, allowEitherOrder);
}
[TestCaseSource(typeof(MathsInt64ExtensionsTestsSource), "GetUpperBound")]
public long GetUpperBound(long min, long max, bool allowEitherOrder)
{
return MathsInt64Extensions.GetUpperBound(min, max, allowEitherOrder);
}
}
}
Loading

0 comments on commit a623605

Please sign in to comment.