├── .Doc
└── docfx_project
│ ├── api
│ ├── index.md
│ └── .gitignore
│ ├── toc.yml
│ ├── images
│ └── logo.png
│ ├── .gitignore
│ └── index.md
├── .tools
├── Cake
│ ├── Cake.runtimeconfig.json
│ ├── Cake.exe
│ ├── Autofac.dll
│ ├── Cake.Core.dll
│ ├── Cake.NuGet.dll
│ ├── Cake.Common.dll
│ ├── NuGet.Common.dll
│ ├── Newtonsoft.Json.dll
│ ├── NuGet.Commands.dll
│ ├── NuGet.Packaging.dll
│ ├── NuGet.Protocol.dll
│ ├── NuGet.Resolver.dll
│ ├── System.Console.dll
│ ├── NuGet.Frameworks.dll
│ ├── NuGet.Versioning.dll
│ ├── System.AppContext.dll
│ ├── System.ValueTuple.dll
│ ├── System.Xml.XPath.dll
│ ├── NuGet.Configuration.dll
│ ├── NuGet.LibraryModel.dll
│ ├── NuGet.Packaging.Core.dll
│ ├── NuGet.ProjectModel.dll
│ ├── System.IO.FileSystem.dll
│ ├── Microsoft.CodeAnalysis.dll
│ ├── System.IO.Compression.dll
│ ├── System.Xml.XmlDocument.dll
│ ├── NuGet.PackageManagement.dll
│ ├── System.Threading.Thread.dll
│ ├── System.Xml.ReaderWriter.dll
│ ├── Microsoft.Web.XmlTransform.dll
│ ├── System.Reflection.Metadata.dll
│ ├── System.Xml.XPath.XDocument.dll
│ ├── Microsoft.CodeAnalysis.CSharp.dll
│ ├── NuGet.DependencyResolver.Core.dll
│ ├── System.Collections.Immutable.dll
│ ├── System.Diagnostics.StackTrace.dll
│ ├── System.Text.Encoding.CodePages.dll
│ ├── Microsoft.CodeAnalysis.Scripting.dll
│ ├── System.IO.FileSystem.Primitives.dll
│ ├── System.Diagnostics.FileVersionInfo.dll
│ ├── System.Security.Cryptography.Encoding.dll
│ ├── Microsoft.CodeAnalysis.CSharp.Scripting.dll
│ ├── System.Security.Cryptography.Algorithms.dll
│ ├── System.Security.Cryptography.Primitives.dll
│ └── System.Security.Cryptography.X509Certificates.dll
├── 7zip
│ └── 7za.exe
├── Curl
│ └── curl.exe
└── NuGet
│ └── nuget.exe
├── .Art
├── logo.png
└── logo.psd
└── .Src
├── Extend
├── Extend.snk
├── Utilities
│ ├── InstanceBuilder
│ │ ├── FluentInterface
│ │ │ └── Definition
│ │ │ │ └── IFactoryOptionsConstistent.cs
│ │ └── MemberSelection
│ │ │ ├── Enum
│ │ │ ├── MemberSelectionMode.cs
│ │ │ ├── CompareMode.cs
│ │ │ ├── MemberSelectionResult.cs
│ │ │ └── MemberSelectionRuleTarget.cs
│ │ │ └── Definition
│ │ │ └── IMemberSelectionRuleInspector.cs
│ ├── Tree
│ │ └── Definition
│ │ │ ├── TreeTraversalDirection.cs
│ │ │ └── ITreeNodeAware.cs
│ └── StringTemplate
│ │ └── ValueProvider
│ │ └── IValueProvider.cs
├── System.String
│ ├── String.IsNotEmpty.cs
│ ├── String.IsEmpty.cs
│ ├── String.IfNotEmpty.cs
│ ├── String.CompareOrdinal.cs
│ ├── String.IsAlpha.cs
│ ├── System.IO.Path
│ │ └── String.GetFileExtension.cs
│ ├── Convert
│ │ └── String.ToGuid.cs
│ ├── String.IsNumeric.cs
│ ├── String.CompareOrdinalIgnoreCase.cs
│ ├── ConvertSafe
│ │ ├── String.SafeToChar.cs
│ │ └── String.SafeToBoolean.cs
│ ├── String.Reverse.cs
│ ├── String.IsAlphaNumeric.cs
│ ├── String.WildcardToRegex.cs
│ └── String.RemoveNumbers.cs
├── System.Int16
│ ├── Int16.IsOdd.cs
│ ├── Int16.IsEven.cs
│ ├── System.DateTime
│ │ ├── Int16.IsLeapYear.cs
│ │ └── FromMonth
│ │ │ ├── Int16.July.cs
│ │ │ ├── Int16.June.cs
│ │ │ ├── Int16.August.cs
│ │ │ ├── Int16.January.cs
│ │ │ ├── Int16.May.cs
│ │ │ ├── Int16.April.cs
│ │ │ ├── Int16.March.cs
│ │ │ ├── Int16.October.cs
│ │ │ ├── Int16.December.cs
│ │ │ ├── Int16.February.cs
│ │ │ ├── Int16.November.cs
│ │ │ └── Int16.September.cs
│ └── Int16.IsMultipleOf.cs
├── System.Int32
│ ├── Int32.IsEven.cs
│ ├── Int32.IsOdd.cs
│ ├── System.DateTime
│ │ ├── Int32.IsLeapYear.cs
│ │ └── FromMonth
│ │ │ ├── Int32.July.cs
│ │ │ ├── Int32.June.cs
│ │ │ ├── Int32.May.cs
│ │ │ ├── Int32.April.cs
│ │ │ ├── Int32.March.cs
│ │ │ ├── Int32.August.cs
│ │ │ ├── Int32.January.cs
│ │ │ ├── Int32.October.cs
│ │ │ ├── Int32.December.cs
│ │ │ ├── Int32.February.cs
│ │ │ ├── Int32.November.cs
│ │ │ └── Int32.September.cs
│ └── Int32.IsMultipleOf.cs
├── System.Int64
│ ├── Int64.IsOdd.cs
│ ├── Int64.IsEven.cs
│ └── Int64.IsMultipleOf.cs
├── System.DateTime
│ ├── DateTime.Tomorrow.cs
│ ├── DateTime.Yesterday.cs
│ ├── DateTime.IsPast.cs
│ ├── DateTime.IsFuture.cs
│ ├── DateTime.IsToday.cs
│ ├── DateTime.IsMorning.cs
│ ├── DateTime.StartOfDay.cs
│ ├── DateTime.StartOfYear.cs
│ ├── DateTime.Elapsed.cs
│ ├── DateTime.IsAfternoon.cs
│ ├── DateTime.IsWeekDay.cs
│ ├── DateTime.StartOfMonth.cs
│ ├── DateTime.IsWeekendDay.cs
│ ├── DateTime.EndOfYear.cs
│ ├── DateTime.NextMonthStart.cs
│ ├── DateTime.IsTimeEquals.cs
│ ├── DateTime.FirstDayOfWeek.cs
│ ├── DateTime.NextWeekDay.cs
│ ├── DateTime.EndOfDay.cs
│ ├── DateTime.IsSameDay.cs
│ ├── DateTime.LastDayOfWeek.cs
│ ├── DateTime.IsLastDayOfMonth.cs
│ └── DateTime.EndOfMonth.cs
├── Models
│ ├── Definitions
│ │ ├── IExecutionResult.cs
│ │ ├── IIndexedItem.cs
│ │ └── IAttributeDefinitionType.cs
│ ├── ExecutionResult.cs
│ └── AttributeDefinitionType.cs
├── System.Double
│ ├── System.TimeSpan
│ │ ├── Double.ToDays.cs
│ │ ├── Double.ToHours.cs
│ │ ├── Double.ToMinutes.cs
│ │ ├── Double.ToSeconds.cs
│ │ └── Double.ToMilliseconds.cs
│ ├── Double.IsNaN.cs
│ ├── Double.IsInfinity.cs
│ ├── Double.IsNegativeInfinity.cs
│ └── Double.IsPositiveInfinity.cs
├── System.Char
│ ├── Char.IsNumber.cs
│ ├── Char.IsLetter.cs
│ ├── Char.IsDigit.cs
│ ├── Char.IsLower.cs
│ ├── Char.IsUpper.cs
│ ├── Char.IsWhiteSpace.cs
│ ├── Char.IsLetterOrDigit.cs
│ ├── Char.Repeat.cs
│ ├── Char.ToLower.cs
│ └── Char.ToUpper.cs
├── System.Object
│ ├── Object.IsNull.cs
│ ├── Object.As.cs
│ ├── Object.IsNotNull.cs
│ └── Generic
│ │ ├── Object.Generic.IsDefault.cs
│ │ └── Object.Generic.ToSingleItemArray.cs
├── System.TimeSpan
│ ├── TimeSpan.Future.cs
│ └── TimeSpan.Past.cs
├── System.Array
│ └── Array.ClearAll.cs
├── System.Lazy[T]
│ └── Layz[T].DisposeIfIsValueCreated.cs
└── System.Random
│ └── Random.CoinToss.cs
└── Extend.Testing
├── System.Char
├── Char.Repeat.Test.cs
├── Char.IsLower.Test.cs
├── Char.IsUpper.Test.cs
├── Char.ToLower.Test.cs
├── Char.ToUpper.Test.cs
├── Char.IsWhiteSpace.Test.cs
├── Char.IsLetter.Test.cs
├── Char.IsDigit.Test.cs
├── Char.IsNumber.Test.cs
└── Char.IsLetterOrDigit.Test.cs
├── System.Int32
├── System.DateTime
│ ├── System.DateTime
│ │ ├── Int32.May.Test.cs
│ │ ├── Int32.July.Test.cs
│ │ ├── Int32.June.Test.cs
│ │ ├── Int32.April.Test.cs
│ │ ├── Int32.August.Test.cs
│ │ ├── Int32.March.Test.cs
│ │ ├── Int32.February.Test.cs
│ │ ├── Int32.January.Test.cs
│ │ ├── Int32.October.Test.cs
│ │ ├── Int32.December.Test.cs
│ │ ├── Int32.November.Test.cs
│ │ └── Int32.September.Test.cs
│ ├── Int32.IsLeapYear.Test.cs
│ └── Int32.DaysInMonth.Test.cs
├── Int32.IsEven.Test.cs
├── Int32.IsOdd.Test.cs
├── System.TimeSpan
│ ├── Int32.ToMinutes.Test.cs
│ ├── Int32.ToSeconds.Test.cs
│ └── Int32.ToMilliseconds.Test.cs
├── Int32.IsMultipleOf.Test.cs
└── Int32.FactorOf.Test.cs
├── System.Int16
├── Int16.IsEven.Test.cs
├── Int16.IsOdd.Test.cs
├── System.DateTime
│ ├── System.DateTime
│ │ ├── Int16.May.Test.cs
│ │ ├── Int16.April.Test.cs
│ │ ├── Int16.July.Test.cs
│ │ ├── Int16.June.Test.cs
│ │ ├── Int16.March.Test.cs
│ │ ├── Int16.August.Test.cs
│ │ ├── Int16.December.Test.cs
│ │ ├── Int16.February.Test.cs
│ │ ├── Int16.January.Test.cs
│ │ ├── Int16.November.Test.cs
│ │ ├── Int16.October.Test.cs
│ │ └── Int16.September.Test.cs
│ ├── Int16.IsLeapYear.Test.cs
│ └── Int16.DaysInMonth.Test.cs
├── System.TimeSpan
│ ├── Int16.ToDays.Test.cs
│ ├── Int16.ToHours.Test.cs
│ ├── Int16.ToMinutes.Test.cs
│ ├── Int16.ToSeconds.Test.cs
│ └── Int16.ToMilliseconds.Test.cs
└── Int16.IsMultipleOf.Test.cs
├── System.DateTime
├── DateTime.Tomorrow.Test.cs
├── DateTime.Yesterday.Test.cs
├── DateTime.StartOfYear.Test.cs
├── DateTime.StartOfMonth.Test.cs
├── DateTime.IsToday.Test.cs
├── DateTime.IsPast.Test.cs
├── DateTime.IsWeekDay.Test.cs
├── DateTime.IsFuture.Test.cs
├── DateTime.IsWeekendDay.Test.cs
├── DateTime.IsMorning.Test.cs
├── DateTime.IsAfternoon.Test.cs
├── DateTime.FirstDayOfWeek.Test.cs
├── DateTime.EndOfMonth.Test.cs
├── DateTime.LastDayOfWeek.Test.cs
├── DateTime.EndOfDay.Test.cs
├── DateTime.StartOfDay.Test.cs
├── DateTime.IsTimeEquals.Test.cs
├── DateTime.Elapsed.Test.cs
└── DateTime.NextWeekDay.cs
├── System.Double
├── System.TimeSpan
│ ├── Double.ToDays.Test.cs
│ ├── Double.ToHours.Test.cs
│ ├── Double.ToMinutes.Test.cs
│ ├── Double.ToSeconds.Test.cs
│ └── Double.ToMilliseconds.Test.cs
├── Double.IsNaN.Test.cs
├── Double.IsInfinit.yTest.cs
├── Double.IsNegativeInfinit.yTest.cs
└── Double.IsPositiveInfinit.yTest.cs
├── System.Object
├── Generic
│ ├── Object.Generic.ToSingleItemArray.Test.cs
│ ├── Object.Generic.IfNull.Test.cs
│ ├── Object.Generic.IsDefault.Test.cs
│ └── Object.Generic.Swap.Test.cs
├── Object.IsNull.Test.cs
├── Object.IsNotNull.Test.cs
└── Object.As.Test.cs
├── System.TimeSpan
├── TimeSpan.Future.Test.cs
└── TimeSpan.Past.Test.cs
├── System.String
├── String.IsEmpty.Test.cs
├── String.IsNotEmpty.Test.cs
├── String.IfNotEmpty.Test.cs
├── String.KeepLetters.Test.cs
├── String.KeepNumbers.Test.cs
├── String.ExtractLetters.Test.cs
├── String.ExtractNumbers.Test.cs
├── String.RemoveLetters.Test.cs
├── String.RemoveNumbers.Test.cs
├── String.SubstringLeft.Test.cs
├── String.SubstringRight.Test.cs
├── String.RemoveLettersAndNumbers.Test.cs
├── String.IsAlpha.Test.cs
├── String.IsNumeric.Test.cs
├── String.KeepLettersAndNumbers.Test.cs
├── System.IO.Path
│ └── String.GetFileExtension.Test.cs
└── String.ToEnum.Test.cs
├── Models
└── IndexedItemTest.cs
├── System.Boolean
└── Boolean.Select.Test.cs
├── System.Int64
├── Int64.IsEven.Test.cs
└── Int64.IsOdd.Test.cs
├── System.Collections.Generic.IEnumerable[T]
└── IEnumerable[T].IsNullOrEmpty.Test.cs
├── Utilities
├── InstanceBuilder
│ └── Extension
│ │ └── MemberSelectionResultExTest.cs
└── StringTemplate
│ └── Model
│ └── FormatInformationTest.cs
├── System.Random
└── Random.CoinToss.Test.cs
├── System.Array
└── System.Array.Generic
│ ├── Array.Generic.Clear.Test.cs
│ ├── Array.Generic.Resize.Test.cs
│ └── Array.Generic.ClearAll.Test.cs
└── System.Enum
└── Enum.GetFlags.Test.cs
/.Doc/docfx_project/api/index.md:
--------------------------------------------------------------------------------
1 | # Extend Api Documentation
--------------------------------------------------------------------------------
/.tools/Cake/Cake.runtimeconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "runtimeOptions": {}
3 | }
--------------------------------------------------------------------------------
/.Art/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.Art/logo.png
--------------------------------------------------------------------------------
/.Art/logo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.Art/logo.psd
--------------------------------------------------------------------------------
/.tools/7zip/7za.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/7zip/7za.exe
--------------------------------------------------------------------------------
/.tools/Cake/Cake.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Cake.exe
--------------------------------------------------------------------------------
/.tools/Curl/curl.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Curl/curl.exe
--------------------------------------------------------------------------------
/.Src/Extend/Extend.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.Src/Extend/Extend.snk
--------------------------------------------------------------------------------
/.tools/Cake/Autofac.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Autofac.dll
--------------------------------------------------------------------------------
/.tools/NuGet/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/NuGet/nuget.exe
--------------------------------------------------------------------------------
/.Doc/docfx_project/api/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # temp file #
3 | ###############
4 | *.yml
5 |
--------------------------------------------------------------------------------
/.tools/Cake/Cake.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Cake.Core.dll
--------------------------------------------------------------------------------
/.tools/Cake/Cake.NuGet.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Cake.NuGet.dll
--------------------------------------------------------------------------------
/.Doc/docfx_project/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Api Documentation
2 | href: api/
3 | homepage: api/Extend.yml
4 |
--------------------------------------------------------------------------------
/.tools/Cake/Cake.Common.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Cake.Common.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Common.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Common.dll
--------------------------------------------------------------------------------
/.tools/Cake/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Commands.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Commands.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Packaging.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Packaging.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Protocol.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Protocol.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Resolver.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Resolver.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Console.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Console.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Frameworks.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Frameworks.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Versioning.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Versioning.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.AppContext.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.AppContext.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.ValueTuple.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.ValueTuple.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Xml.XPath.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Xml.XPath.dll
--------------------------------------------------------------------------------
/.Doc/docfx_project/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.Doc/docfx_project/images/logo.png
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Configuration.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Configuration.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.LibraryModel.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.LibraryModel.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.Packaging.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.Packaging.Core.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.ProjectModel.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.ProjectModel.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.IO.FileSystem.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.IO.FileSystem.dll
--------------------------------------------------------------------------------
/.tools/Cake/Microsoft.CodeAnalysis.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Microsoft.CodeAnalysis.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.IO.Compression.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.IO.Compression.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Xml.XmlDocument.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Xml.XmlDocument.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.PackageManagement.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.PackageManagement.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Threading.Thread.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Threading.Thread.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Xml.ReaderWriter.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Xml.ReaderWriter.dll
--------------------------------------------------------------------------------
/.tools/Cake/Microsoft.Web.XmlTransform.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Microsoft.Web.XmlTransform.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Reflection.Metadata.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Reflection.Metadata.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Xml.XPath.XDocument.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Xml.XPath.XDocument.dll
--------------------------------------------------------------------------------
/.tools/Cake/Microsoft.CodeAnalysis.CSharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Microsoft.CodeAnalysis.CSharp.dll
--------------------------------------------------------------------------------
/.tools/Cake/NuGet.DependencyResolver.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/NuGet.DependencyResolver.Core.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Collections.Immutable.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Collections.Immutable.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Diagnostics.StackTrace.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Diagnostics.StackTrace.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Text.Encoding.CodePages.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Text.Encoding.CodePages.dll
--------------------------------------------------------------------------------
/.tools/Cake/Microsoft.CodeAnalysis.Scripting.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Microsoft.CodeAnalysis.Scripting.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.IO.FileSystem.Primitives.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.IO.FileSystem.Primitives.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Diagnostics.FileVersionInfo.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Diagnostics.FileVersionInfo.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Security.Cryptography.Encoding.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Security.Cryptography.Encoding.dll
--------------------------------------------------------------------------------
/.tools/Cake/Microsoft.CodeAnalysis.CSharp.Scripting.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/Microsoft.CodeAnalysis.CSharp.Scripting.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Security.Cryptography.Algorithms.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Security.Cryptography.Algorithms.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Security.Cryptography.Primitives.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Security.Cryptography.Primitives.dll
--------------------------------------------------------------------------------
/.tools/Cake/System.Security.Cryptography.X509Certificates.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DaveSenn/Extend/HEAD/.tools/Cake/System.Security.Cryptography.X509Certificates.dll
--------------------------------------------------------------------------------
/.Doc/docfx_project/.gitignore:
--------------------------------------------------------------------------------
1 | ###############
2 | # folder #
3 | ###############
4 | /**/DROP/
5 | /**/TEMP/
6 | /**/packages/
7 | /**/bin/
8 | /**/obj/
9 | _site
10 |
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.Repeat.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class CharExTest
10 | {
11 | [Fact]
12 | public void RepeatTest()
13 | {
14 | var actual = 'a'.Repeat( 3 );
15 | Assert.Equal( "aaa", actual );
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsLower.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class CharExTest
10 | {
11 | [Fact]
12 | public void IsLowerTest()
13 | {
14 | Assert.True( 'a'.IsLower() );
15 | Assert.False( 'A'.IsLower() );
16 | Assert.False( '1'.IsLower() );
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsUpper.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class CharExTest
10 | {
11 | [Fact]
12 | public void IsUpperTest()
13 | {
14 | Assert.False( 'a'.IsUpper() );
15 | Assert.True( 'A'.IsUpper() );
16 | Assert.False( '1'.IsUpper() );
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/InstanceBuilder/FluentInterface/Definition/IFactoryOptionsConstistent.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Interface representing a configured factory.
5 | ///
6 | /// The type of the object to create.
7 | public interface IFactoryOptionsConstistent : IFactoryOptionsInconsistent, ICreateInstanceOptions where T : class
8 | {
9 | }
10 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.ToLower.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class CharExTest
10 | {
11 | [Fact]
12 | public void ToLowerTest()
13 | {
14 | Assert.Equal( 'a', 'A'.ToLower() );
15 | Assert.Equal( 'a', 'a'.ToLower() );
16 | Assert.Equal( '1', '1'.ToLower() );
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.ToUpper.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class CharExTest
10 | {
11 | [Fact]
12 | public void ToUpperTest()
13 | {
14 | Assert.Equal( 'A', 'A'.ToUpper() );
15 | Assert.Equal( 'A', 'a'.ToUpper() );
16 | Assert.Equal( '1', '1'.ToUpper() );
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.May.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void MayTest()
14 | {
15 | var expected = new DateTime( 2000, 5, 10 );
16 | var actual = 10.May( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.July.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void JulyTest()
14 | {
15 | var expected = new DateTime( 2000, 7, 10 );
16 | var actual = 10.July( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.June.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void JuneTest()
14 | {
15 | var expected = new DateTime( 2000, 6, 10 );
16 | var actual = 10.June( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/InstanceBuilder/MemberSelection/Enum/MemberSelectionMode.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Enumeration of all member selection modes.
5 | ///
6 | public enum MemberSelectionMode
7 | {
8 | ///
9 | /// Include a member.
10 | ///
11 | Include = 0,
12 |
13 | ///
14 | /// Exude a member.
15 | ///
16 | Exclude = 1
17 | }
18 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/Tree/Definition/TreeTraversalDirection.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Enumeration of all traversal directions.
5 | ///
6 | public enum TreeTraversalDirection
7 | {
8 | ///
9 | /// Traverse from top to bottom.
10 | ///
11 | TopDown,
12 |
13 | ///
14 | /// Traverse from bottom to top.
15 | ///
16 | BottomUp
17 | }
18 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/Int16.IsEven.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int16ExTest
10 | {
11 | [Fact]
12 | public void IsEvenTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt16();
15 |
16 | var expected = value % 2 == 0;
17 | var actual = value.IsEven();
18 | Assert.Equal( expected, actual );
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/Int16.IsOdd.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int16ExTest
10 | {
11 | [Fact]
12 | public void IsOddTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt16();
15 |
16 | var expected = value % 2 != 0;
17 | var actual = value.IsOdd();
18 | Assert.Equal( expected, actual );
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.May.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void MayTest()
14 | {
15 | var expected = new DateTime( 2000, 5, 10 );
16 | var actual = Int16Ex.May( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/Int32.IsEven.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int32ExTest
10 | {
11 | [Fact]
12 | public void IsEvenTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt32();
15 |
16 | var expected = value % 2 == 0;
17 | var actual = value.IsEven();
18 | Assert.Equal( expected, actual );
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/Int32.IsOdd.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int32ExTest
10 | {
11 | [Fact]
12 | public void IsOddTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt32();
15 |
16 | var expected = value % 2 != 0;
17 | var actual = value.IsOdd();
18 | Assert.Equal( expected, actual );
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.April.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void AprilTest()
14 | {
15 | var expected = new DateTime( 2000, 4, 10 );
16 | var actual = 10.April( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.August.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void AugustTest()
14 | {
15 | var expected = new DateTime( 2000, 8, 10 );
16 | var actual = 10.August( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.March.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void MarchTest()
14 | {
15 | var expected = new DateTime( 2000, 3, 10 );
16 | var actual = 10.March( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/InstanceBuilder/MemberSelection/Enum/CompareMode.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Enumeration of all possible compare modes.
5 | ///
6 | public enum CompareMode
7 | {
8 | ///
9 | /// Check if equals to value.
10 | ///
11 | Is = 0,
12 |
13 | ///
14 | /// Check if is not equals to value.
15 | ///
16 | IsNot = 1
17 | }
18 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.April.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void AprilTest()
14 | {
15 | var expected = new DateTime( 2000, 4, 10 );
16 | var actual = Int16Ex.April( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.July.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void JulyTest()
14 | {
15 | var expected = new DateTime( 2000, 7, 10 );
16 | var actual = Int16Ex.July( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.June.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void JuneTest()
14 | {
15 | var expected = new DateTime( 2000, 6, 10 );
16 | var actual = Int16Ex.June( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.March.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void MarchTest()
14 | {
15 | var expected = new DateTime( 2000, 3, 10 );
16 | var actual = Int16Ex.March( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.February.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void FebruaryTest()
14 | {
15 | var expected = new DateTime( 2000, 2, 10 );
16 | var actual = 10.February( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.January.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void JanuaryTest()
14 | {
15 | var expected = new DateTime( 2000, 1, 10 );
16 | var actual = 10.January( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.October.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void OctoberTest()
14 | {
15 | var expected = new DateTime( 2000, 10, 10 );
16 | var actual = 10.October( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.August.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void AugustTest()
14 | {
15 | var expected = new DateTime( 2000, 8, 10 );
16 | var actual = Int16Ex.August( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.December.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void DecemberTest()
14 | {
15 | var expected = new DateTime( 2000, 12, 10 );
16 | var actual = 10.December( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.November.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void NovemberTest()
14 | {
15 | var expected = new DateTime( 2000, 11, 10 );
16 | var actual = 10.November( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/System.DateTime/Int32.September.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void SeptemberTest()
14 | {
15 | var expected = new DateTime( 2000, 9, 10 );
16 | var actual = 10.September( 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.December.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void DecemberTest()
14 | {
15 | var expected = new DateTime( 2000, 12, 10 );
16 | var actual = Int16Ex.December( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.February.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void FebruaryTest()
14 | {
15 | var expected = new DateTime( 2000, 2, 10 );
16 | var actual = Int16Ex.February( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.January.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void JanuaryTest()
14 | {
15 | var expected = new DateTime( 2000, 1, 10 );
16 | var actual = Int16Ex.January( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.November.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void NovemberTest()
14 | {
15 | var expected = new DateTime( 2000, 11, 10 );
16 | var actual = Int16Ex.November( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.October.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void OctoberTest()
14 | {
15 | var expected = new DateTime( 2000, 10, 10 );
16 | var actual = Int16Ex.October( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/System.DateTime/Int16.September.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void SeptemberTest()
14 | {
15 | var expected = new DateTime( 2000, 9, 10 );
16 | var actual = Int16Ex.September( 10, 2000 );
17 | Assert.Equal( expected, actual );
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.Tomorrow.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void TomorrowTest()
14 | {
15 | var dateTime = DateTime.Today;
16 | var expected = dateTime.AddDays( 1 );
17 | var actual = dateTime.Tomorrow();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.Yesterday.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void YesterdayTest()
14 | {
15 | var dateTime = DateTime.Today;
16 | var expected = dateTime.AddDays( -1 );
17 | var actual = dateTime.Yesterday();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/System.TimeSpan/Double.ToDays.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void ToDaysTest()
14 | {
15 | const Double number = 10.5;
16 | var expected = TimeSpan.FromDays( number );
17 | var actual = number.ToDays();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/System.TimeSpan/Double.ToHours.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void ToHoursTest()
14 | {
15 | const Double number = 10.5;
16 | var expected = TimeSpan.FromHours( number );
17 | var actual = number.ToHours();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/System.TimeSpan/Double.ToMinutes.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void ToMinutesTest()
14 | {
15 | const Double number = 10.5;
16 | var expected = TimeSpan.FromMinutes( number );
17 | var actual = number.ToMinutes();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/System.TimeSpan/Double.ToSeconds.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void ToSecondsTest()
14 | {
15 | const Double number = 10.5;
16 | var expected = TimeSpan.FromSeconds( number );
17 | var actual = number.ToSeconds();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.StartOfYear.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void StartOfYearTest()
14 | {
15 | var dateTime = DateTime.Today;
16 | var expected = new DateTime( dateTime.Year, 1, 1 );
17 | var actual = dateTime.StartOfYear();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Generic/Object.Generic.ToSingleItemArray.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class ObjectExTest
10 | {
11 | [Fact]
12 | public void ToSingleItemArrayTest()
13 | {
14 | var item = RandomValueEx.GetRandomString();
15 |
16 | var actual = item.ToSingleItemArray();
17 |
18 | Assert.Single( actual );
19 | Assert.Equal( item, actual[0] );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.TimeSpan/TimeSpan.Future.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class TimeSpanExTest
11 | {
12 | [Fact]
13 | public void FutureTest()
14 | {
15 | var expected = DateTime.Now.Add( TimeSpan.FromDays( 1 ) );
16 | var actual = TimeSpan.FromDays( 1 )
17 | .Future();
18 |
19 | Assert.Equal( expected.Day, actual.Day );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.TimeSpan/TimeSpan.Past.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class TimeSpanExTest
11 | {
12 | [Fact]
13 | public void FPastTest()
14 | {
15 | var expected = DateTime.Now.Subtract( TimeSpan.FromDays( 1 ) );
16 | var actual = TimeSpan.FromDays( 1 )
17 | .Past();
18 |
19 | Assert.Equal( expected.Day, actual.Day );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsWhiteSpace.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class CharExTest
10 | {
11 | [Fact]
12 | public void IsWhiteSpaceTest()
13 | {
14 | Assert.False( 'a'.IsWhiteSpace() );
15 | Assert.False( 'A'.IsWhiteSpace() );
16 | Assert.False( 'z'.IsWhiteSpace() );
17 | Assert.False( '-'.IsWhiteSpace() );
18 | Assert.True( ' '.IsWhiteSpace() );
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/System.TimeSpan/Double.ToMilliseconds.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void ToMillisecondsTest()
14 | {
15 | const Double number = 10.5;
16 | var expected = TimeSpan.FromMilliseconds( number );
17 | var actual = number.ToMilliseconds();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.TimeSpan/Int16.ToDays.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void ToDaysTest()
14 | {
15 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
16 |
17 | var expected = TimeSpan.FromDays( value );
18 | var actual = ( (Int16) value ).ToDays();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.StartOfMonth.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void StartOfMonthTest()
14 | {
15 | var dateTime = DateTime.Today;
16 | var expected = new DateTime( dateTime.Year, dateTime.Month, 1 );
17 | var actual = dateTime.StartOfMonth();
18 |
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/Double.IsNaN.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void IsNaNTest()
14 | {
15 | var number = 10.5;
16 | var actual = number.IsNaN();
17 |
18 | Assert.False( actual );
19 |
20 | number = Double.NaN;
21 | actual = number.IsNaN();
22 |
23 | Assert.True( actual );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.TimeSpan/Int16.ToHours.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void ToHoursTest()
14 | {
15 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
16 |
17 | var expected = TimeSpan.FromHours( value );
18 | var actual = ( (Int16) value ).ToHours();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/Int32.IsLeapYear.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void IsLeapYearTest()
14 | {
15 | var year = RandomValueEx.GetRandomInt32( 1990, 2015 );
16 |
17 | var expected = DateTime.IsLeapYear( year );
18 | var actual = year.IsLeapYear();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.TimeSpan/Int16.ToMinutes.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void ToMinutesTest()
14 | {
15 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
16 |
17 | var expected = TimeSpan.FromMinutes( value );
18 | var actual = ( (Int16) value ).ToMinutes();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.TimeSpan/Int16.ToSeconds.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void ToSecondsTest()
14 | {
15 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
16 |
17 | var expected = TimeSpan.FromSeconds( value );
18 | var actual = ( (Int16) value ).ToSeconds();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/Int16.IsLeapYear.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void IsLeapYearTest()
14 | {
15 | var year = RandomValueEx.GetRandomInt32( 1990, 2015 );
16 |
17 | var expected = DateTime.IsLeapYear( year );
18 | var actual = ( (Int16) year ).IsLeapYear();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.TimeSpan/Int16.ToMilliseconds.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void ToMillisecondsTest()
14 | {
15 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
16 |
17 | var expected = TimeSpan.FromMilliseconds( value );
18 | var actual = ( (Int16) value ).ToMilliseconds();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsToday.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsTodayTest()
14 | {
15 | var dateTime = DateTime.Now;
16 | var actual = dateTime.IsToday();
17 | Assert.True( actual );
18 |
19 | dateTime = DateTime.Now.AddDays( 2 );
20 | actual = dateTime.IsToday();
21 | Assert.False( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Generic/Object.Generic.IfNull.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class ObjectExTest
10 | {
11 | [Fact]
12 | public void IfNullTest()
13 | {
14 | var expected = RandomValueEx.GetRandomString();
15 |
16 | var actual = ObjectEx.IfNull( null, expected );
17 | Assert.Equal( expected, actual );
18 |
19 | actual = expected.IfNull( null );
20 | Assert.Equal( expected, actual );
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/Tree/Definition/ITreeNodeAware.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Interface representing a type which gets informed about it's tree node.
5 | ///
6 | /// The type of the nodes value.
7 | public interface ITreeNodeAware
8 | {
9 | #region Properties
10 |
11 | ///
12 | /// Gets or sets the node of the object.
13 | ///
14 | /// The node of the object.
15 | ITreeNode Node { get; set; }
16 |
17 | #endregion
18 | }
19 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsPast.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsPastTest()
14 | {
15 | var dateTime = DateTime.Now.Subtract( 1.ToMilliseconds() );
16 | var actual = dateTime.IsPast();
17 | Assert.True( actual );
18 |
19 | dateTime = DateTime.Now.AddDays( 2 );
20 | actual = dateTime.IsPast();
21 | Assert.False( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsWeekDay.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsWeekdDayTest()
14 | {
15 | var dateTime = new DateTime( 2014, 3, 27 );
16 | var actual = dateTime.IsWeekdDay();
17 | Assert.True( actual );
18 |
19 | dateTime = new DateTime( 2014, 3, 29 );
20 | actual = dateTime.IsWeekdDay();
21 | Assert.False( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsFuture.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsFutureTest()
14 | {
15 | var dateTime = DateTime.Now.Subtract( 1.ToMilliseconds() );
16 | var actual = dateTime.IsFuture();
17 | Assert.False( actual );
18 |
19 | dateTime = DateTime.Now.AddDays( 2 );
20 | actual = dateTime.IsFuture();
21 | Assert.True( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsWeekendDay.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsWeekendDayTest()
14 | {
15 | var dateTime = new DateTime( 2014, 3, 27 );
16 | var actual = dateTime.IsWeekendDay();
17 | Assert.False( actual );
18 |
19 | dateTime = new DateTime( 2014, 3, 29 );
20 | actual = dateTime.IsWeekendDay();
21 | Assert.True( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Object.IsNull.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class ObjectExTest
10 | {
11 | [Fact]
12 | public void IsNullTest()
13 | {
14 | var value = RandomValueEx.GetRandomString();
15 | var actual = value.IsNull();
16 |
17 | Assert.False( actual );
18 |
19 | value = null;
20 | // ReSharper disable once ExpressionIsAlwaysNull
21 | actual = value.IsNull();
22 |
23 | Assert.True( actual );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.TimeSpan/Int32.ToMinutes.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class Int32ExTest
12 | {
13 | [Fact]
14 | public void ToMinutesTest()
15 | {
16 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
17 |
18 | var expected = TimeSpan.FromMinutes( value );
19 | var actual = value.ToMinutes();
20 |
21 | actual
22 | .Should()
23 | .Be( expected );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.TimeSpan/Int32.ToSeconds.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class Int32ExTest
12 | {
13 | [Fact]
14 | public void ToSecondsTest()
15 | {
16 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
17 |
18 | var expected = TimeSpan.FromSeconds( value );
19 | var actual = value.ToSeconds();
20 |
21 | actual
22 | .Should()
23 | .Be( expected );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsMorning.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsMorningTest()
14 | {
15 | var dateTime = new DateTime( 2014, 10, 10, 13, 0, 0 );
16 | var actual = dateTime.IsMorning();
17 | Assert.False( actual );
18 |
19 | dateTime = new DateTime( 2014, 10, 10, 10, 0, 0 );
20 | actual = dateTime.IsMorning();
21 | Assert.True( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Object.IsNotNull.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class ObjectExTest
10 | {
11 | [Fact]
12 | public void IsNotNullTest()
13 | {
14 | var value = RandomValueEx.GetRandomString();
15 | var actual = value.IsNotNull();
16 |
17 | Assert.True( actual );
18 |
19 | value = null;
20 | // ReSharper disable once ExpressionIsAlwaysNull
21 | actual = value.IsNotNull();
22 |
23 | Assert.False( actual );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsAfternoon.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsAfternoonTest()
14 | {
15 | var dateTime = new DateTime( 2014, 10, 10, 13, 0, 0 );
16 | var actual = dateTime.IsAfternoon();
17 | Assert.True( actual );
18 |
19 | dateTime = new DateTime( 2014, 10, 10, 10, 0, 0 );
20 | actual = dateTime.IsAfternoon();
21 | Assert.False( actual );
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.DateTime/Int32.DaysInMonth.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int32ExTest
11 | {
12 | [Fact]
13 | public void DaysInMonthTest()
14 | {
15 | var year = RandomValueEx.GetRandomInt32( 1990, 2015 );
16 | var month = RandomValueEx.GetRandomInt32( 1, 12 );
17 |
18 | var expected = DateTime.DaysInMonth( year, month );
19 | var actual = year.DaysInMonth( month );
20 | Assert.Equal( expected, actual );
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.FirstDayOfWeek.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void FirstDayOfWeekTest()
14 | {
15 | var dateTime = RandomValueEx.GetRandomDateTime();
16 | var expected =
17 | new DateTime( dateTime.Year, dateTime.Month, dateTime.Day ).AddDays( -(Int32) dateTime.DayOfWeek );
18 | var actual = dateTime.FirstDayOfWeek();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/System.TimeSpan/Int32.ToMilliseconds.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class Int32ExTest
12 | {
13 | [Fact]
14 | public void ToMillisecondsTest()
15 | {
16 | var value = RandomValueEx.GetRandomInt32( 1, 100 );
17 |
18 | var expected = TimeSpan.FromMilliseconds( value );
19 | var actual = value.ToMilliseconds();
20 |
21 | actual
22 | .Should()
23 | .Be( expected );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.IsEmpty.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class StringExTest
10 | {
11 | [Fact]
12 | public void IsEmptyTest()
13 | {
14 | var value = "";
15 | Assert.True( value.IsEmpty() );
16 |
17 | value = null;
18 | Assert.True( value.IsEmpty() );
19 |
20 | value = " ";
21 | Assert.True( value.IsEmpty() );
22 |
23 | value = RandomValueEx.GetRandomString();
24 | Assert.False( value.IsEmpty() );
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/InstanceBuilder/MemberSelection/Enum/MemberSelectionResult.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Enumeration of all possible member selection results.
5 | ///
6 | public enum MemberSelectionResult
7 | {
8 | ///
9 | /// Include the member.
10 | ///
11 | IncludeMember = 0,
12 |
13 | ///
14 | /// Exclude the member.
15 | ///
16 | ExcludeMember = 1,
17 |
18 | ///
19 | /// Rule does not apply to member.
20 | ///
21 | Neutral = 2
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/Models/IndexedItemTest.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public class IndexedItemTest
12 | {
13 | [Fact]
14 | public void CtorTest()
15 | {
16 | var index = RandomValueEx.GetRandomInt32();
17 | var value = RandomValueEx.GetRandomString();
18 | var target = new IndexedItem( index, value );
19 |
20 | target.Index.Should()
21 | .Be( index );
22 | target.Item.Should()
23 | .Be( value );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/System.DateTime/Int16.DaysInMonth.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int16ExTest
11 | {
12 | [Fact]
13 | public void DaysInMonthTest()
14 | {
15 | var year = RandomValueEx.GetRandomInt32( 1990, 2015 );
16 | var month = RandomValueEx.GetRandomInt32( 1, 12 );
17 |
18 | var expected = DateTime.DaysInMonth( year, month );
19 | var actual = ( (Int16) year ).DaysInMonth( (Int16) month );
20 | Assert.Equal( expected, actual );
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Boolean/Boolean.Select.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class BooleanExTest
11 | {
12 | [Fact]
13 | public void SelectValueTest()
14 | {
15 | const String trueValue = "true";
16 | const String falseValue = "false";
17 |
18 | var actual = false.SelectValue( trueValue, falseValue );
19 | Assert.Equal( falseValue, actual );
20 |
21 | actual = true.SelectValue( trueValue, falseValue );
22 | Assert.Equal( trueValue, actual );
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsLetter.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System.Linq;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class CharExTest
11 | {
12 | [Fact]
13 | public void IsLetterTest()
14 | {
15 | var range = 0.RangeTo( 9 );
16 | foreach ( var c in range.Select( x => x.ToChar() ) )
17 | Assert.False( c.IsLetter() );
18 |
19 | Assert.True( 'a'.IsLetter() );
20 | Assert.True( 'A'.IsLetter() );
21 | Assert.True( 'z'.IsLetter() );
22 | Assert.False( '-'.IsLetter() );
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.EndOfMonth.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void EndOfMonthTest()
14 | {
15 | var dateTime = DateTime.Now;
16 | var expected = new DateTime( dateTime.Year, dateTime.Month, 1 ).AddMonths( 1 )
17 | .Subtract( 1.ToMilliseconds() );
18 | var actual = dateTime.EndOfMonth();
19 | Assert.Equal( expected, actual );
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Generic/Object.Generic.IsDefault.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class ObjectExTest
11 | {
12 | [Fact]
13 | public void IsDefaultTest()
14 | {
15 | var value = default(String);
16 | // ReSharper disable once ExpressionIsAlwaysNull
17 | var actual = value.IsDefault();
18 | Assert.True( actual );
19 |
20 | value = RandomValueEx.GetRandomString();
21 | actual = value.IsDefault();
22 | Assert.False( actual );
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.IsNotEmpty.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class StringExTest
10 | {
11 | [Fact]
12 | public void IsNotEmptyTest()
13 | {
14 | var value = "";
15 | Assert.False( value.IsNotEmpty() );
16 |
17 | value = null;
18 | Assert.False( value.IsNotEmpty() );
19 |
20 | value = " ";
21 | Assert.False( value.IsNotEmpty() );
22 |
23 | value = RandomValueEx.GetRandomString();
24 | Assert.True( value.IsNotEmpty() );
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Object.As.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class ObjectExTest
12 | {
13 | [Fact]
14 | public void AsTest()
15 | {
16 | Object value = 10;
17 | var actual = value.As();
18 |
19 | Assert.Equal( value, actual );
20 | }
21 |
22 | [Fact]
23 | public void AsTestNullValue()
24 | {
25 | var res = ObjectEx.As( null );
26 | res.Should()
27 | .BeNull();
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.LastDayOfWeek.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void LastDayOfWeekTest()
14 | {
15 | var dateTime = new DateTime( 2014, 3, 30 );
16 | var actual = dateTime.LastDayOfWeek();
17 |
18 | Assert.Equal( dateTime, actual );
19 |
20 | dateTime = new DateTime( 2014, 3, 28 );
21 | actual = dateTime.LastDayOfWeek();
22 |
23 | Assert.Equal( new DateTime( 2014, 3, 30 ), actual );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.EndOfDay.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void EndOfDayTest()
14 | {
15 | var dateTime = DateTime.Now;
16 | var expected =
17 | new DateTime( dateTime.Year, dateTime.Month, dateTime.Day ).AddDays( 1 )
18 | .Subtract( 1.ToMilliseconds() );
19 | var actual = dateTime.EndOfDay();
20 | Assert.Equal( expected, actual );
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.IsNotEmpty.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Gets whether the given is empty or not.
14 | ///
15 | /// The to check.
16 | /// A value of true if the given is not empty, otherwise false.
17 | [Pure]
18 | [PublicAPI]
19 | public static Boolean IsNotEmpty( [CanBeNull] this String input )
20 | => !IsEmpty( input );
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.StartOfDay.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void StartOfDaykTest()
14 | {
15 | var dateTime = new DateTime( 2014, 3, 30, 12, 0, 2 );
16 | var actual = dateTime.StartOfDay();
17 |
18 | Assert.Equal( new DateTime( 2014, 3, 30 ), actual );
19 |
20 | dateTime = new DateTime( 2014, 3, 28, 5, 12, 2 );
21 | actual = dateTime.StartOfDay();
22 |
23 | Assert.Equal( new DateTime( 2014, 3, 28 ), actual );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.IfNotEmpty.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class StringExTest
10 | {
11 | [Fact]
12 | public void IfEmptyTest()
13 | {
14 | var actual = StringEx.IfNotEmpty( null, "test" );
15 | Assert.Equal( "test", actual );
16 |
17 | actual = "".IfNotEmpty( "test" );
18 | Assert.Equal( "test", actual );
19 |
20 | actual = " ".IfNotEmpty( "test" );
21 | Assert.Equal( "test", actual );
22 |
23 | actual = "abc".IfNotEmpty( "test" );
24 | Assert.Equal( "abc", actual );
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/StringTemplate/ValueProvider/IValueProvider.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend.Internal
8 | {
9 | ///
10 | /// Class representing a value provider for string formating.
11 | ///
12 | public interface IValueProvider
13 | {
14 | ///
15 | /// Gets the value represented by the given expression.
16 | ///
17 | /// The name of a property optionally combined with a string format compatible expression.
18 | /// Returns the value represented by the given expression.
19 | String GetValue( String expression );
20 | }
21 | }
--------------------------------------------------------------------------------
/.Doc/docfx_project/index.md:
--------------------------------------------------------------------------------
1 | # Welcome to Extend
2 |
3 | ### What is this?
4 |
5 | Extend is a set of .Net extension methods build as portable class library.
6 | Extend enhance the .Net framework by adding a bunch of methods to increase developer’s productivity.
7 | Currently it contains 377 unique extension methods (623 overloads included).
8 | ### Where can I use it?
9 | You can use it in every .Net application or library targeting one of the following profiles:
10 | * .Net 4.5
11 | * Windows 8
12 | * Windows Phone 8
13 | * Windows Phone 8.1
14 |
15 | ### How do I use it?
16 | 1. Install ["Extend"](http://www.nuget.org/packages/Extend/) via [NuGet](http://nuget.org)
17 | __Install-Package PortableExtensions__
18 | 2. Add using for Extend ```using Extend; ```
19 | 3. Done!
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/Int16.IsOdd.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Checks if the Int16 is odd.
17 | ///
18 | /// The Int16 to check.
19 | /// Returns true if the Int16 is odd, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsOdd( this Int16 value )
23 | => value % 2 != 0;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/Int32.IsEven.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Checks if the Int32 is even.
17 | ///
18 | /// The Int32 to check.
19 | /// Returns true if the Int32 is even, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsEven( this Int32 value )
23 | => value % 2 == 0;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/Int32.IsOdd.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Checks if the Int32 is odd.
17 | ///
18 | /// The Int32 to check.
19 | /// Returns true if the Int32 is odd, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsOdd( this Int32 value )
23 | => value % 2 != 0;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int64/Int64.IsOdd.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int64Ex
14 | {
15 | ///
16 | /// Checks if the Int64 is odd.
17 | ///
18 | /// The Int64 to check.
19 | /// Returns true if the Int64 is odd, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsOdd( this Int64 value )
23 | => value % 2 != 0;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/Int16.IsEven.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Checks if the Int16 is even.
17 | ///
18 | /// The Int16 to check.
19 | /// Returns true if the Int16 is even, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsEven( this Int16 value )
23 | => value % 2 == 0;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int64/Int64.IsEven.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int64Ex
14 | {
15 | ///
16 | /// Checks if the Int64 is even.
17 | ///
18 | /// The Int64 to check.
19 | /// Returns true if the Int64 is even, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsEven( this Int64 value )
23 | => value % 2 == 0;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.IsEmpty.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Gets whether the given is empty or not.
14 | ///
15 | /// The to check.
16 | /// A value of true if the given is empty, otherwise false.
17 | [Pure]
18 | [PublicAPI]
19 | public static Boolean IsEmpty( [CanBeNull] this String str )
20 | => String.IsNullOrEmpty( str ) || String.IsNullOrWhiteSpace( str );
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/Double.IsInfinit.yTest.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void IsInfinityTest()
14 | {
15 | var number = 10.5;
16 | var actual = number.IsInfinity();
17 |
18 | Assert.False( actual );
19 |
20 | number = Double.NegativeInfinity;
21 | actual = number.IsInfinity();
22 |
23 | Assert.True( actual );
24 |
25 | number = Double.PositiveInfinity;
26 | actual = number.IsInfinity();
27 |
28 | Assert.True( actual );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.IsTimeEquals.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void IsTimeEqualTest()
14 | {
15 | var dateTime = DateTime.Now;
16 | var dateTime1 = dateTime.AddDays( -2 );
17 |
18 | var actual = dateTime.IsTimeEquals( dateTime1 );
19 | Assert.True( actual );
20 |
21 | dateTime1 = dateTime.AddDays( -2 )
22 | .AddHours( 1 );
23 |
24 | actual = dateTime.IsTimeEquals( dateTime1 );
25 | Assert.False( actual );
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.Tomorrow.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Adds a day to the given date time value.
17 | ///
18 | /// The date time to increase.
19 | /// Tomorrow date at same time.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime Tomorrow( this DateTime dateTime )
23 | => dateTime.AddDays( 1 );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int64/Int64.IsEven.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using FluentAssertions;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class Int64ExTest
11 | {
12 | [Fact]
13 | public void IsEvenOTest()
14 | {
15 | var actual = Int64Ex.IsEven( 0 );
16 | actual.Should()
17 | .Be( true );
18 | }
19 |
20 | [Fact]
21 | public void IsEvenTest()
22 | {
23 | var value = RandomValueEx.GetRandomInt32();
24 |
25 | var expected = value % 2 == 0;
26 | var actual = Int64Ex.IsEven( value );
27 | actual.Should()
28 | .Be( expected );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend/Models/Definitions/IExecutionResult.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Interface representing the result of a safe method execution.
11 | ///
12 | public interface IExecutionResult
13 | {
14 | #region Properties
15 |
16 | ///
17 | /// Gets or sets the exception.
18 | ///
19 | /// The exception.
20 | Exception Exception { get; set; }
21 |
22 | ///
23 | /// Gets or sets the result.
24 | ///
25 | /// The result.
26 | T Result { get; set; }
27 |
28 | #endregion
29 | }
30 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/System.TimeSpan/Double.ToDays.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns the given Double value as day.
17 | ///
18 | /// The Double value.
19 | /// Returns the given Double value as days.
20 | [Pure]
21 | [PublicAPI]
22 | public static TimeSpan ToDays( this Double value )
23 | => TimeSpan.FromDays( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Collections.Generic.IEnumerable[T]/IEnumerable[T].IsNullOrEmpty.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | // ReSharper disable once InconsistentNaming
12 | public partial class IEnumerableTExTest
13 | {
14 | [Fact]
15 | public void IsNullOrEmptyTest()
16 | {
17 | List list = null;
18 | Assert.True( list.IsNullOrEmpty() );
19 |
20 | list = new List();
21 | Assert.True( list.IsNullOrEmpty() );
22 |
23 | list.Add( RandomValueEx.GetRandomString() );
24 | Assert.False( list.IsNullOrEmpty() );
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/System.TimeSpan/Double.ToHours.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns the given Double value as hours.
17 | ///
18 | /// The Double value.
19 | /// Returns the given Double value as hours.
20 | [Pure]
21 | [PublicAPI]
22 | public static TimeSpan ToHours( this Double value )
23 | => TimeSpan.FromHours( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/Double.IsNaN.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns whether the specified value is not a number.
17 | ///
18 | /// The double to check.
19 | /// Returns true if the value is not a number, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsNaN( this Double value )
23 | => Double.IsNaN( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.Elapsed.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void ElapsedTest()
14 | {
15 | var dateTime = new DateTime( 1980, 1, 1 );
16 | var expected = DateTime.Now - dateTime;
17 | var actual = dateTime.Elapsed();
18 |
19 | // remove milliseconds
20 | expected = new TimeSpan( expected.Days, expected.Hours, expected.Minutes, expected.Seconds );
21 | actual = new TimeSpan( actual.Days, actual.Hours, actual.Minutes, actual.Seconds );
22 | Assert.Equal( expected, actual );
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/System.TimeSpan/Double.ToMinutes.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns the given Double value as minutes.
17 | ///
18 | /// The Double value.
19 | /// Returns the given Double value as minutes.
20 | [Pure]
21 | [PublicAPI]
22 | public static TimeSpan ToMinutes( this Double value )
23 | => TimeSpan.FromMinutes( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/System.TimeSpan/Double.ToSeconds.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns the given Double value as seconds.
17 | ///
18 | /// The Double value.
19 | /// Returns the given Double value as seconds.
20 | [Pure]
21 | [PublicAPI]
22 | public static TimeSpan ToSeconds( this Double value )
23 | => TimeSpan.FromSeconds( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/Double.IsNegativeInfinit.yTest.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void IsNegativeInfinityTest()
14 | {
15 | var number = 10.5;
16 | var actual = number.IsNegativeInfinity();
17 |
18 | Assert.False( actual );
19 |
20 | number = Double.NegativeInfinity;
21 | actual = number.IsNegativeInfinity();
22 |
23 | Assert.True( actual );
24 |
25 | number = Double.PositiveInfinity;
26 | actual = number.IsNegativeInfinity();
27 |
28 | Assert.False( actual );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Double/Double.IsPositiveInfinit.yTest.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DoubleExTest
11 | {
12 | [Fact]
13 | public void IsPositiveInfinityTest()
14 | {
15 | var number = 10.5;
16 | var actual = number.IsPositiveInfinity();
17 |
18 | Assert.False( actual );
19 |
20 | number = Double.NegativeInfinity;
21 | actual = number.IsPositiveInfinity();
22 |
23 | Assert.False( actual );
24 |
25 | number = Double.PositiveInfinity;
26 | actual = number.IsPositiveInfinity();
27 |
28 | Assert.True( actual );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend/Models/Definitions/IIndexedItem.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Interface representing an item with an index.
11 | ///
12 | /// The type of the item
13 | public interface IIndexedItem
14 | {
15 | #region Properties
16 |
17 | ///
18 | /// Gets the index of the item.
19 | ///
20 | /// The index of the item.
21 | Int32 Index { get; }
22 |
23 | ///
24 | /// Gets the item.
25 | ///
26 | /// The item.
27 | T Item { get; }
28 |
29 | #endregion
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.Yesterday.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Subtracts a day to the given date dateTime value.
17 | ///
18 | /// The date dateTime to decrease.
19 | /// Yesterday date at same dateTime.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime Yesterday( this DateTime dateTime )
23 | => dateTime.AddDays( -1 );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsPast.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks if the date time value is in the past.
17 | ///
18 | /// The date time to check.
19 | /// Returns true if the value is in the past, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsPast( this DateTime dateTime )
23 | => dateTime < DateTime.Now;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/Int16.IsLeapYear.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns whether the given year is a leap year or not.
17 | ///
18 | /// The year.
19 | /// Returns true if the year is a leap year, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsLeapYear( this Int16 year )
23 | => DateTime.IsLeapYear( year );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/Int32.IsLeapYear.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns whether the given year is a leap year or not.
17 | ///
18 | /// The year.
19 | /// Returns true if the year is a leap year, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsLeapYear( this Int32 year )
23 | => DateTime.IsLeapYear( year );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsNumber.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as a number.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is a number, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsNumber( this Char c )
23 | => Char.IsNumber( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/InstanceBuilder/MemberSelection/Enum/MemberSelectionRuleTarget.cs:
--------------------------------------------------------------------------------
1 | namespace Extend
2 | {
3 | ///
4 | /// Enumeration of all member selection rule targets.
5 | ///
6 | ///
7 | /// Used to build create instance options.
8 | ///
9 | internal enum MemberSelectionRuleTarget
10 | {
11 | ///
12 | /// The rule targets the member itself.
13 | ///
14 | Member = 0,
15 |
16 | ///
17 | /// The rule targets the children of the member.
18 | ///
19 | MemberChildren = 1,
20 |
21 | ///
22 | /// The rule targets a factory.
23 | ///
24 | Factory = 2
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int64/Int64.IsOdd.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class Int64ExTest
12 | {
13 | [Fact]
14 | public void IsOdd0Test()
15 | {
16 | const Int64 value = 0;
17 |
18 | var actual = value.IsOdd();
19 | actual.Should()
20 | .BeFalse();
21 | }
22 |
23 | [Fact]
24 | public void IsOddTest()
25 | {
26 | var value = RandomValueEx.GetRandomInt32();
27 |
28 | var expected = value % 2 != 0;
29 | var actual = Int64Ex.IsOdd( value );
30 | Assert.Equal( expected, actual );
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsLetter.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as a Unicode letter.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is a letter, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsLetter( this Char c )
23 | => Char.IsLetter( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsFuture.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks if the date time value is in the future.
17 | ///
18 | /// The @date time to check.
19 | /// Returns true if the value is in the future, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsFuture( this DateTime dateTime )
23 | => dateTime > DateTime.Now;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsToday.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks if the given date time is today.
17 | ///
18 | /// The date time to check.
19 | /// Returns true if the date time value is today, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsToday( this DateTime dateTime )
23 | => dateTime.Date == DateTime.Today;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.KeepLetters.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void KeepLettersTest()
14 | {
15 | var actual = "a1b2c3".KeepLetters();
16 | Assert.Equal( "abc", actual );
17 | }
18 |
19 | [Fact]
20 | public void KeepLettersTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.KeepLetters( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/Models/ExecutionResult.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Class representing the result of a safe method execution.
11 | ///
12 | public class ExecutionResult : IExecutionResult
13 | {
14 | #region Implementation of IExecutionResult
15 |
16 | ///
17 | /// Gets or sets the exception.
18 | ///
19 | /// The exception.
20 | public Exception Exception { get; set; }
21 |
22 | ///
23 | /// Gets or sets the result.
24 | ///
25 | /// The result.
26 | public T Result { get; set; }
27 |
28 | #endregion
29 | }
30 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsDigit.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as a decimal digit.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is a decimal digit, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsDigit( this Char c )
23 | => Char.IsDigit( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsMorning.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks is the date time value is morning.
17 | ///
18 | /// The date time to check.
19 | /// Returns true if the date time is morning, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsMorning( this DateTime dateTime )
23 | => dateTime.TimeOfDay.TotalHours < 12;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/System.TimeSpan/Double.ToMilliseconds.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns the given Double value as milliseconds.
17 | ///
18 | /// The Double value.
19 | /// Returns the given Double value as milliseconds.
20 | [Pure]
21 | [PublicAPI]
22 | public static TimeSpan ToMilliseconds( this Double value )
23 | => TimeSpan.FromMilliseconds( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.KeepNumbers.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void KeepNumbersTest()
14 | {
15 | var actual = "a1b2c3".KeepNumbers();
16 | Assert.Equal( "123", actual );
17 | }
18 |
19 | [Fact]
20 | public void KeepNumbersTEstCaseNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.KeepNumbers( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsLower.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as a lowercase letter.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is a lowercase letter, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsLower( this Char c )
23 | => Char.IsLower( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Object/Object.IsNull.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class ObjectEx
14 | {
15 | ///
16 | /// Gets whether the given is null or not.
17 | ///
18 | /// The to check.
19 | /// A value of true if the is null, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsNull( [CanBeNull] this Object obj )
23 | => obj == null;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsUpper.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as an uppercase letter.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is an uppercase letter, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsUpper( this Char c )
23 | => Char.IsUpper( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsWhiteSpace.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as white space.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is a white space, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsWhiteSpace( this Char c )
23 | => Char.IsWhiteSpace( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Object/Object.As.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class ObjectEx
14 | {
15 | ///
16 | /// Cast the given object to the specified type.
17 | ///
18 | /// The type.
19 | /// The object to cast.
20 | /// The object as the specified type.
21 | [CanBeNull]
22 | [Pure]
23 | [PublicAPI]
24 | public static T As( [CanBeNull] this Object obj )
25 | => (T) obj;
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.TimeSpan/TimeSpan.Future.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class TimeSpanEx
14 | {
15 | ///
16 | /// Adds the given time span to the current date time.
17 | ///
18 | /// The time span to add.
19 | /// Returns the current date time with the specified time span added to it.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime Future( this TimeSpan timeSpan )
23 | => DateTime.Now.Add( timeSpan );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.ExtractLetters.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void ExtractLettersTest()
14 | {
15 | var actual = "1a2b3c4".ExtractLetters();
16 | Assert.Equal( "abc", actual );
17 | }
18 |
19 | [Fact]
20 | public void ExtractLettersTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.ExtractLetters( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.ExtractNumbers.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void ExtractNumbersTest()
14 | {
15 | var actual = "1a2b3c4".ExtractNumbers();
16 | Assert.Equal( "1234", actual );
17 | }
18 |
19 | [Fact]
20 | public void ExtractNumbersTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.ExtractNumbers( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.RemoveLetters.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void RemoveLettersTest()
14 | {
15 | var actual = "a1-b2.c3".RemoveLetters();
16 | Assert.Equal( "1-2.3", actual );
17 | }
18 |
19 | [Fact]
20 | public void RemoveLettersTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.RemoveLetters( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.RemoveNumbers.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void RemoveNumbersTest()
14 | {
15 | var actual = "a1-b2.c3".RemoveNumbers();
16 | Assert.Equal( "a-b.c", actual );
17 | }
18 |
19 | [Fact]
20 | public void RemoveNumbersTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.RemoveNumbers( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.SubstringLeft.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void SubstringLeftTest()
14 | {
15 | var actual = "testabc".SubstringLeft( 4 );
16 | Assert.Equal( "test", actual );
17 | }
18 |
19 | [Fact]
20 | public void SubstringLeftTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.SubstringLeft( null, 1 );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.StartOfDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the start of the given day ("00:00:00:000").
17 | ///
18 | /// The day to get the start of.
19 | /// Returns the start of the given day ("00:00:00:000").
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime StartOfDay( this DateTime day )
23 | => new DateTime( day.Year, day.Month, day.Day );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.SubstringRight.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void SubstringRightTest()
14 | {
15 | var actual = "testabc".SubstringRight( 3 );
16 | Assert.Equal( "abc", actual );
17 | }
18 |
19 | [Fact]
20 | public void SubstringRightTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.SubstringRight( null, 5 );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/Double.IsInfinity.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns whether the specified number evaluates to negative or positive infinity.
17 | ///
18 | /// The double to check.
19 | /// Returns true if the given double is infinity, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsInfinity( this Double value )
23 | => Double.IsInfinity( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Object/Object.IsNotNull.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class ObjectEx
14 | {
15 | ///
16 | /// Gets whether the given is NOT null or not.
17 | ///
18 | /// The to check.
19 | /// A value of true if the is NOT null, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsNotNull( [CanBeNull] this Object obj )
23 | => obj != null;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.IfNotEmpty.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Returns the input value if it's not empty, otherwise the alternative value.
14 | ///
15 | /// The input string.
16 | /// The alternative value.
17 | /// The input or the alternative value.
18 | [CanBeNull]
19 | [Pure]
20 | [PublicAPI]
21 | public static String IfNotEmpty( [CanBeNull] this String value, [CanBeNull] String alternativeValue )
22 | => !value.IsEmpty() ? value : alternativeValue;
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/Utilities/InstanceBuilder/Extension/MemberSelectionResultExTest.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using FluentAssertions;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public class MemberSelectionResultExTest
11 | {
12 | [Fact]
13 | public void AsBooleanTest()
14 | {
15 | MemberSelectionResult.IncludeMember.AsBoolean()
16 | .Should()
17 | .BeTrue();
18 | MemberSelectionResult.ExcludeMember.AsBoolean()
19 | .Should()
20 | .BeFalse();
21 | MemberSelectionResult.Neutral.AsBoolean()
22 | .Should()
23 | .Be( null );
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/Utilities/InstanceBuilder/MemberSelection/Definition/IMemberSelectionRuleInspector.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System.Collections.Generic;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Interface representing a rule inspector.
11 | ///
12 | public interface IMemberSelectionRuleInspector
13 | {
14 | ///
15 | /// Inspects the given rules for the given member.
16 | ///
17 | /// A collection of rules.
18 | /// The member information to check.
19 | /// Returns the inspection result.
20 | MemberSelectionResult Inspect( IEnumerable rules, IMemberInformation memberInformation );
21 | }
22 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.TimeSpan/TimeSpan.Past.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class TimeSpanEx
14 | {
15 | ///
16 | /// Subtracts the specified time span to the current date time.
17 | ///
18 | /// The time span to subtract.
19 | /// Returns the current date time with the specified time span subtracted from it.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime Past( this TimeSpan timeSpan )
23 | => DateTime.Now.Subtract( timeSpan );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Array/Array.ClearAll.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class ArrayEx
14 | {
15 | ///
16 | /// Clears the given array.
17 | ///
18 | /// The array can not be null.
19 | /// The array to clear.
20 | [PublicAPI]
21 | public static void ClearAll( [NotNull] this Array array )
22 | {
23 | array.ThrowIfNull( nameof(array) );
24 |
25 | Array.Clear( array, 0, array.Length );
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.StartOfYear.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the start of the given year with time set to "00:00:00:000".
17 | ///
18 | /// The year to get the start of.
19 | /// Returns the start of the given year with time set to "00:00:00:000".
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime StartOfYear( this DateTime year )
23 | => new DateTime( year.Year, 1, 1 );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.DateTime/DateTime.NextWeekDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class DateTimeExTest
11 | {
12 | [Fact]
13 | public void NextWeekDayTest()
14 | {
15 | var friday = new DateTime( 2014, 8, 8 );
16 | var saturday = new DateTime( 2014, 8, 9 );
17 | var sunday = new DateTime( 2014, 8, 10 );
18 |
19 | var actual = friday.NextWeekDay();
20 | Assert.Equal( friday, actual );
21 |
22 | actual = saturday.NextWeekDay();
23 | Assert.Equal( new DateTime( 2014, 8, 11 ), actual );
24 |
25 | actual = sunday.NextWeekDay();
26 | Assert.Equal( new DateTime( 2014, 8, 11 ), actual );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.Elapsed.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Calculates the elapsed time between the given date time value and DateTime.Now.
17 | ///
18 | /// The date time value.
19 | /// Returns the elapsed time between the given date time value and DateTime.Now.
20 | [Pure]
21 | [PublicAPI]
22 | public static TimeSpan Elapsed( this DateTime dateTime )
23 | => DateTime.Now - dateTime;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsAfternoon.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks whether the given date time value is at afternoon or not.
17 | ///
18 | /// The date time to check.
19 | /// Returns true if the date time value is at afternoon, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsAfternoon( this DateTime dateTime )
23 | => dateTime.TimeOfDay.TotalHours >= 12;
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/Double.IsNegativeInfinity.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns whether the specified number evaluates to negative infinity.
17 | ///
18 | /// The double to check.
19 | /// Returns true if the given double is negative infinity, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsNegativeInfinity( this Double value )
23 | => Double.IsNegativeInfinity( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Double/Double.IsPositiveInfinity.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DoubleEx
14 | {
15 | ///
16 | /// Returns whether the specified number evaluates to positive infinity.
17 | ///
18 | /// The double to check.
19 | /// Returns true if the given double is positive infinity, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsPositiveInfinity( this Double value )
23 | => Double.IsPositiveInfinity( value );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.CompareOrdinal.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Compares the given strings using .
14 | ///
15 | /// The first string to compare.
16 | /// The second string to compare.
17 | /// Returns true if the given strings are equals, otherwise false.
18 | [Pure]
19 | [PublicAPI]
20 | public static Boolean CompareOrdinal( this String value, String compareValue )
21 | => String.Compare( value, compareValue, StringComparison.Ordinal ) == 0;
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.IsLetterOrDigit.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Indicates whether the specified Unicode character is categorized as a letter or a decimal digit.
17 | ///
18 | /// The Unicode character to evaluate.
19 | /// True if the given char is a letter or a decimal digit, otherwise false.
20 | [PublicAPI]
21 | [Pure]
22 | public static Boolean IsLetterOrDigit( this Char c )
23 | => Char.IsLetterOrDigit( c );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsWeekDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks if the given day is a week day (MOnday - Friday).
17 | ///
18 | /// The day to check.
19 | /// Returns true if the day is a week day, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsWeekdDay( this DateTime day )
23 | => day.DayOfWeek != DayOfWeek.Saturday
24 | && day.DayOfWeek != DayOfWeek.Sunday;
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.RemoveLettersAndNumbers.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void RemoveLettersAndNumbersTest()
14 | {
15 | var actual = "a1-b2.c3".RemoveLettersAndNumbers();
16 | Assert.Equal( "-.", actual );
17 | }
18 |
19 | [Fact]
20 | public void RemoveLettersAndNumbersTestNullCheck()
21 | {
22 | // ReSharper disable once AssignNullToNotNullAttribute
23 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
24 | Action test = () => StringEx.RemoveLettersAndNumbers( null );
25 |
26 | Assert.Throws( test );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.StartOfMonth.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the start of the given month (with time set to "00:00:00:000").
17 | ///
18 | /// The month to get the start of.
19 | /// Returns the start of the given month (with time set to "00:00:00:000").
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime StartOfMonth( this DateTime month )
23 | => new DateTime( month.Year, month.Month, 1 );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.IsAlpha.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void IsAlphaTest()
14 | {
15 | var actual = "test".IsAlpha();
16 | Assert.True( actual );
17 |
18 | actual = "1test".IsAlpha();
19 | Assert.False( actual );
20 | }
21 |
22 | [Fact]
23 | public void IsAlphaTestNullCheck()
24 | {
25 | // ReSharper disable once AssignNullToNotNullAttribute
26 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
27 | Action test = () => StringEx.IsAlpha( null );
28 |
29 | Assert.Throws( test );
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsDigit.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using FluentAssertions;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class CharExTest
11 | {
12 | [Fact]
13 | public void IsDigitTest()
14 | {
15 | '0'.IsDigit()
16 | .Should()
17 | .BeTrue();
18 | '9'.IsDigit()
19 | .Should()
20 | .BeTrue();
21 |
22 | 'a'.IsDigit()
23 | .Should()
24 | .BeFalse();
25 | 'A'.IsDigit()
26 | .Should()
27 | .BeFalse();
28 | 'z'.IsDigit()
29 | .Should()
30 | .BeFalse();
31 | '-'.IsDigit()
32 | .Should()
33 | .BeFalse();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsWeekendDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks if the given day is a weekend day (Saturday or Sunday).
17 | ///
18 | /// The day to check.
19 | /// Returns true if the day is a weekend day, otherwise false.
20 | [Pure]
21 | [PublicAPI]
22 | public static Boolean IsWeekendDay( this DateTime day )
23 | => day.DayOfWeek == DayOfWeek.Saturday
24 | || day.DayOfWeek == DayOfWeek.Sunday;
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsNumber.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using FluentAssertions;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class CharExTest
11 | {
12 | [Fact]
13 | public void IsNumberTest()
14 | {
15 | '0'.IsNumber()
16 | .Should()
17 | .BeTrue();
18 | '9'.IsNumber()
19 | .Should()
20 | .BeTrue();
21 |
22 | 'a'.IsNumber()
23 | .Should()
24 | .BeFalse();
25 | 'A'.IsNumber()
26 | .Should()
27 | .BeFalse();
28 | 'z'.IsNumber()
29 | .Should()
30 | .BeFalse();
31 | '-'.IsNumber()
32 | .Should()
33 | .BeFalse();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Random/Random.CoinToss.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class RandomExTest
12 | {
13 | [Fact]
14 | public void CoinTossTest()
15 | {
16 | var random = new Random();
17 | var actual = random.CoinToss();
18 |
19 | actual.Should()
20 | .Be( actual );
21 | }
22 |
23 | [Fact]
24 | public void CoinTossTestNullCheck()
25 | {
26 | // ReSharper disable once AssignNullToNotNullAttribute
27 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
28 | Action test = () => RandomEx.CoinToss( null );
29 |
30 | Assert.Throws( test );
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.IsAlpha.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Linq;
5 | using JetBrains.Annotations;
6 |
7 | #endregion
8 |
9 | namespace Extend
10 | {
11 | public static partial class StringEx
12 | {
13 | ///
14 | /// Checks if the string is alpha.
15 | ///
16 | /// The string can not be null.
17 | /// The string to check.
18 | /// Returns true if the string is alpha only, otherwise false.
19 | [Pure]
20 | [PublicAPI]
21 | public static Boolean IsAlpha( [NotNull] this String str )
22 | {
23 | str.ThrowIfNull( nameof(str) );
24 |
25 | return str.ToCharArray()
26 | .All( x => x.IsLetter() );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.EndOfYear.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the last moment ("23:59:59:999") of the year represented by the given date time.
17 | ///
18 | /// The year to return the end of.
19 | /// Returns the last moment ("23:59:59:999") of the year represented by the given date time.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime EndOfYear( this DateTime year )
23 | => new DateTime( year.Year, 12, 31, 23, 59, 59, 999 );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.NextMonthStart.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the first day of the next month, based on the given date-time value.
17 | ///
18 | /// The date-time value.
19 | /// Returns the first day of the next month, based on the given date-time value.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime NextMonthStart( this DateTime dateTime )
23 | => dateTime.AddMonths( 1 )
24 | .StartOfMonth();
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.July.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Class containing some extension methods for .
11 | ///
12 | public static partial class Int16Ex
13 | {
14 | ///
15 | /// Returns a date-time representing the specified day in July
16 | /// in the specified year.
17 | ///
18 | /// The day.
19 | /// The year.
20 | /// Return a date-time representing the specified day in July in the specified year.
21 | /// [Pure]
22 | /// [PublicAPI]
23 | public static DateTime July( this Int16 day, Int16 year )
24 | => new DateTime( year, 7, day );
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.June.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Class containing some extension methods for .
11 | ///
12 | public static partial class Int16Ex
13 | {
14 | ///
15 | /// Returns a date-time representing the specified day in June
16 | /// in the specified year.
17 | ///
18 | /// The day.
19 | /// The year.
20 | /// Return a date-time representing the specified day in June in the specified year.
21 | /// [Pure]
22 | /// [PublicAPI]
23 | public static DateTime June( this Int16 day, Int16 year )
24 | => new DateTime( year, 6, day );
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Object/Generic/Object.Generic.IsDefault.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class ObjectEx
14 | {
15 | ///
16 | /// Checks if the given value is the default value of it's type.
17 | ///
18 | /// The type of the value.
19 | /// The value to check.
20 | /// Returns true if the value is the default value of it's type.
21 | [Pure]
22 | [PublicAPI]
23 | public static Boolean IsDefault( [CanBeNull] this T value )
24 | => Equals( value, default(T) );
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/System.IO.Path/String.GetFileExtension.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.IO;
5 | using JetBrains.Annotations;
6 |
7 | #endregion
8 |
9 | namespace Extend
10 | {
11 | public static partial class StringEx
12 | {
13 | ///
14 | /// Gets the extension of the given file.
15 | ///
16 | /// The file name can not be null.
17 | /// The name of the file.
18 | /// The file extension.
19 | [NotNull]
20 | [Pure]
21 | [PublicAPI]
22 | public static String GetFileExtension( [NotNull] this String fileName )
23 | {
24 | fileName.ThrowIfNull( nameof(fileName) );
25 |
26 | return Path.GetExtension( fileName );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Array/System.Array.Generic/Array.Generic.Clear.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class ArrayExTest
11 | {
12 | [Fact]
13 | public void GenericClearTest()
14 | {
15 | var array = new[]
16 | {
17 | "test",
18 | "test"
19 | };
20 | array.Clear( 0, 2 );
21 |
22 | Assert.Null( array[0] );
23 | Assert.Null( array[1] );
24 | }
25 |
26 | [Fact]
27 | public void GenericClearTest1()
28 | {
29 | // ReSharper disable once AssignNullToNotNullAttribute
30 | Action test = () => ArrayEx.Clear( null, 0, 2 );
31 | Assert.Throws( test );
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsTimeEquals.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Checks if the time is equals to the given time.
17 | ///
18 | /// The time to check.
19 | /// The time to compare.
20 | /// Returns true if the time is equals, otherwise false.
21 | [Pure]
22 | [PublicAPI]
23 | public static Boolean IsTimeEquals( this DateTime time, DateTime timeToCompare )
24 | => time.TimeOfDay == timeToCompare.TimeOfDay;
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/Convert/String.ToGuid.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Converts the given string to a GUID.
14 | ///
15 | /// The value can not be null.
16 | /// value is not in a recognized format.
17 | /// The string to convert.
18 | /// Returns the converted GUID.
19 | [Pure]
20 | [PublicAPI]
21 | public static Guid ToGuid( [NotNull] this String value )
22 | {
23 | value.ThrowIfNull( nameof(value) );
24 |
25 | return Guid.Parse( value );
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.IsNumeric.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Linq;
5 | using JetBrains.Annotations;
6 |
7 | #endregion
8 |
9 | namespace Extend
10 | {
11 | public static partial class StringEx
12 | {
13 | ///
14 | /// Checks if the string is numeric.
15 | ///
16 | /// The string can not be null.
17 | /// The string to check.
18 | /// Returns true if the string is numeric only, otherwise false.
19 | [Pure]
20 | [PublicAPI]
21 | public static Boolean IsNumeric( [NotNull] this String str )
22 | {
23 | str.ThrowIfNull( nameof(str) );
24 |
25 | return str.ToCharArray()
26 | .All( x => x.IsNumber() );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.FirstDayOfWeek.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the first day of the week, represented by the given date time.
17 | ///
18 | /// The week to return the first day of.
19 | /// Returns the first day of the week, represented by the given date time.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime FirstDayOfWeek( this DateTime week )
23 | => new DateTime( week.Year, week.Month, week.Day ).AddDays( -(Int32) week.DayOfWeek );
24 | }
25 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.August.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Class containing some extension methods for .
11 | ///
12 | public static partial class Int16Ex
13 | {
14 | ///
15 | /// Returns a date-time representing the specified day in August
16 | /// in the specified year.
17 | ///
18 | /// The day.
19 | /// The year.
20 | /// Return a date-time representing the specified day in August in the specified year.
21 | /// [Pure]
22 | /// [PublicAPI]
23 | public static DateTime August( this Int16 day, Int16 year )
24 | => new DateTime( year, 8, day );
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.January.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Class containing some extension methods for .
11 | ///
12 | public static partial class Int16Ex
13 | {
14 | ///
15 | /// Returns a date-time representing the specified day in January
16 | /// in the specified year.
17 | ///
18 | /// The day.
19 | /// The year.
20 | /// Return a date-time representing the specified day in January in the specified year.
21 | /// [Pure]
22 | /// [PublicAPI]
23 | public static DateTime January( this Int16 day, Int16 year )
24 | => new DateTime( year, 1, day );
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.CompareOrdinalIgnoreCase.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Compares the given strings using .
14 | ///
15 | /// The first string to compare.
16 | /// The second string to compare.
17 | /// Returns true if the given strings are equals, otherwise false.
18 | [Pure]
19 | [PublicAPI]
20 | public static Boolean CompareOrdinalIgnoreCase( [CanBeNull] this String value, [CanBeNull] String compareValue )
21 | => String.Compare( value, compareValue, StringComparison.OrdinalIgnoreCase ) == 0;
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Array/System.Array.Generic/Array.Generic.Resize.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class ArrayExTest
11 | {
12 | [Fact]
13 | public void GenericResizeTest()
14 | {
15 | var array = new[]
16 | {
17 | "test",
18 | "test2"
19 | };
20 | array = array.Resize( 10 );
21 | Assert.Equal( 10, array.Length );
22 | }
23 |
24 | [Fact]
25 | public void GenericResizeTestNullCheck()
26 | {
27 | String[] array = null;
28 | // ReSharper disable once AssignNullToNotNullAttribute
29 | Action test = () => array.Resize( 10 );
30 |
31 | Assert.Throws( test );
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/.Src/Extend/Models/Definitions/IAttributeDefinitionType.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Interface representing the attribute definitions of a type.
12 | ///
13 | /// The type of the attributes.
14 | public interface IAttributeDefinitionType where T : Attribute
15 | {
16 | #region Properties
17 |
18 | ///
19 | /// Gets or sets the type.
20 | ///
21 | /// The type.
22 | Type Type { get; set; }
23 |
24 | ///
25 | /// Gets or sets the attributes.
26 | ///
27 | /// The attributes.
28 | IEnumerable Attributes { get; set; }
29 |
30 | #endregion
31 | }
32 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int16/Int16.IsMultipleOf.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int16ExTest
10 | {
11 | [Fact]
12 | public void IsMultipleOfTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt16();
15 | var factor = RandomValueEx.GetRandomInt16();
16 |
17 | var expected = value % factor == 0;
18 | var actual = value.IsMultipleOf( factor );
19 | Assert.Equal( expected, actual );
20 |
21 | value = 10;
22 | factor = 2;
23 |
24 | actual = value.IsMultipleOf( factor );
25 | Assert.True( actual );
26 |
27 | value = 10;
28 | factor = 3;
29 |
30 | actual = value.IsMultipleOf( factor );
31 | Assert.False( actual );
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/Int32.IsMultipleOf.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int32ExTest
10 | {
11 | [Fact]
12 | public void IsMultipleOfTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt32();
15 | var factor = RandomValueEx.GetRandomInt32();
16 |
17 | var expected = value % factor == 0;
18 | var actual = value.IsMultipleOf( factor );
19 | Assert.Equal( expected, actual );
20 |
21 | value = 10;
22 | factor = 2;
23 |
24 | actual = value.IsMultipleOf( factor );
25 | Assert.True( actual );
26 |
27 | value = 10;
28 | factor = 3;
29 |
30 | actual = value.IsMultipleOf( factor );
31 | Assert.False( actual );
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/Utilities/StringTemplate/Model/FormatInformationTest.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Extend.Internal;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing.Internal
10 | {
11 | public class FormatInformationTest
12 | {
13 | [Fact]
14 | public void FormatTest()
15 | {
16 | var expected = RandomValueEx.GetRandomString();
17 | var target = new FormatInformation( "name", expected );
18 |
19 | target.Format.Should()
20 | .Be( expected );
21 | }
22 |
23 | [Fact]
24 | public void ValueNameTest()
25 | {
26 | var expected = RandomValueEx.GetRandomString();
27 | var target = new FormatInformation( expected, null );
28 |
29 | target.ValueName.Should()
30 | .Be( expected );
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/ConvertSafe/String.SafeToChar.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Converts the value of the specified string to its equivalent Unicode character.
14 | ///
15 | /// A string that contains a single character.
16 | /// The default value, returned if the parsing fails.
17 | /// Returns the converted value, or the given default value if the conversion failed.
18 | [Pure]
19 | [PublicAPI]
20 | public static Char SafeToChar( [CanBeNull] this String value, Char defaultValue = default )
21 | => value.TryParsChar( out var outValue ) ? outValue : defaultValue;
22 | }
23 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Int32/Int32.FactorOf.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using Xunit;
4 |
5 | #endregion
6 |
7 | namespace Extend.Testing
8 | {
9 | public partial class Int32ExTest
10 | {
11 | [Fact]
12 | public void FactorOfTest()
13 | {
14 | var value = RandomValueEx.GetRandomInt32();
15 | var factorNumer = RandomValueEx.GetRandomInt32();
16 |
17 | var expected = factorNumer % value == 0;
18 | var actual = value.FactorOf( factorNumer );
19 | Assert.Equal( expected, actual );
20 |
21 | value = 10;
22 | factorNumer = 100;
23 | actual = value.FactorOf( factorNumer );
24 | Assert.True( actual );
25 |
26 | value = 11;
27 | factorNumer = 100;
28 | actual = value.FactorOf( factorNumer );
29 | Assert.False( actual );
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.NextWeekDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Gets the next week day, based on the given day.
17 | ///
18 | /// The day.
19 | /// Returns the next week day (can be if the given day is a week day).
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime NextWeekDay( this DateTime day )
23 | {
24 | while ( day.IsWeekendDay() )
25 | day = day.Add( 1.ToDays() );
26 | return day;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.May.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in May
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in May in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime May( this Int16 day, Int16 year )
25 | => new DateTime( year, 5, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.July.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in July
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in July in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime July( this Int32 day, Int32 year )
25 | => new DateTime( year, 7, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.June.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in June
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in June in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime June( this Int32 day, Int32 year )
25 | => new DateTime( year, 6, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.May.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in May
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in May in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime May( this Int32 day, Int32 year )
25 | => new DateTime( year, 5, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.Reverse.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Reverses the given string.
14 | ///
15 | /// The string can not be null.
16 | /// The string to reverse.
17 | /// Returns the reversed string.
18 | [NotNull]
19 | [Pure]
20 | [PublicAPI]
21 | public static String Reverse( [NotNull] this String s )
22 | {
23 | s.ThrowIfNull( nameof(s) );
24 |
25 | return s.Length <= 1
26 | ? s
27 | : new String( s.ToCharArray()
28 | .Reverse() );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.April.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in April
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in April in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime April( this Int16 day, Int16 year )
25 | => new DateTime( year, 4, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.March.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in March
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in March in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime March( this Int16 day, Int16 year )
25 | => new DateTime( year, 3, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.April.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in April
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in April in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime April( this Int32 day, Int32 year )
25 | => new DateTime( year, 4, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.March.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in March
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in March in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime March( this Int32 day, Int32 year )
25 | => new DateTime( year, 3, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Lazy[T]/Layz[T].DisposeIfIsValueCreated.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing extension methods for .
12 | ///
13 | public static class LayzEx
14 | {
15 | ///
16 | /// Disposes the value of the given lazy, if the value was created.
17 | ///
18 | /// The type of object that is being lazily initialized.
19 | /// A see .
20 | [PublicAPI]
21 | public static void DisposeIfIsValueCreated( [CanBeNull] this Lazy lazy ) where T : IDisposable
22 | {
23 | if ( lazy != null && lazy.IsValueCreated )
24 | lazy.Value.Dispose();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Char/Char.IsLetterOrDigit.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using FluentAssertions;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class CharExTest
11 | {
12 | [Fact]
13 | public void IsLetterOrDigitTest()
14 | {
15 | '0'.IsLetterOrDigit()
16 | .Should()
17 | .BeTrue();
18 | '9'.IsLetterOrDigit()
19 | .Should()
20 | .BeTrue();
21 |
22 | 'a'.IsLetterOrDigit()
23 | .Should()
24 | .BeTrue();
25 | 'A'.IsLetterOrDigit()
26 | .Should()
27 | .BeTrue();
28 | 'z'.IsLetterOrDigit()
29 | .Should()
30 | .BeTrue();
31 | '-'.IsLetterOrDigit()
32 | .Should()
33 | .BeFalse();
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.Repeat.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Repeats the given Char the specified number of times.
17 | ///
18 | /// repeatCount is less than zero.
19 | /// The Char to repeat.
20 | /// Number of repeats.
21 | /// The repeated Char as String.
22 | [PublicAPI]
23 | [Pure]
24 | public static String Repeat( this Char c, Int32 repeatCount )
25 | => new String( c, repeatCount );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.August.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in August
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in August in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime August( this Int32 day, Int32 year )
25 | => new DateTime( year, 8, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.IsAlphaNumeric.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Linq;
5 | using JetBrains.Annotations;
6 |
7 | #endregion
8 |
9 | namespace Extend
10 | {
11 | public static partial class StringEx
12 | {
13 | ///
14 | /// Checks if the string is alpha numeric.
15 | ///
16 | /// The string can not be null.
17 | /// The string to check.
18 | /// Returns true if the string is alpha numeric, otherwise false.
19 | [Pure]
20 | [PublicAPI]
21 | public static Boolean IsAlphaNumeric( [NotNull] this String str )
22 | {
23 | str.ThrowIfNull( nameof(str) );
24 |
25 | return str.ToCharArray()
26 | .All( x => x.IsLetter() || x.IsNumber() );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Array/System.Array.Generic/Array.Generic.ClearAll.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class ArrayExTest
11 | {
12 | [Fact]
13 | public void GenericClearAllTest()
14 | {
15 | var array = new[]
16 | {
17 | "test",
18 | "test"
19 | };
20 | array.ClearAll();
21 |
22 | Assert.Null( array[0] );
23 | Assert.Null( array[1] );
24 | }
25 |
26 | [Fact]
27 | public void GenericClearAllTest1()
28 | {
29 | String[] array = null;
30 | // ReSharper disable once AssignNullToNotNullAttribute
31 | Action test = () => array.ClearAll();
32 |
33 | Assert.Throws( test );
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.October.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in October
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in October in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime October( this Int16 day, Int16 year )
25 | => new DateTime( year, 10, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.January.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in January
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in January in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime January( this Int32 day, Int32 year )
25 | => new DateTime( year, 1, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.October.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in October
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in October in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime October( this Int32 day, Int32 year )
25 | => new DateTime( year, 10, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Object/Generic/Object.Generic.Swap.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class ObjectExTest
12 | {
13 | [Fact]
14 | public void SwapTest()
15 | {
16 | var value0 = new List();
17 | var value1 = new List { RandomValueEx.GetRandomString() };
18 |
19 | this.Swap( ref value0, ref value1 );
20 | Assert.Single( value0 );
21 | Assert.Empty( value1 );
22 | }
23 |
24 | [Fact]
25 | public void SwapTest1()
26 | {
27 | var value0 = 10;
28 | var value1 = 100;
29 |
30 | this.Swap( ref value0, ref value1 );
31 | Assert.Equal( 100, value0 );
32 | Assert.Equal( 10, value1 );
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.EndOfDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the last moment of the day ("23:59:59:999") represented by the given date time value.
17 | ///
18 | /// The day to get the end of.
19 | /// Returns the last moment of the day ("23:59:59:999") represented by the given date time value.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime EndOfDay( this DateTime day )
23 | => day
24 | .Date.AddDays( 1 )
25 | .Subtract( 1.ToMilliseconds() );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.December.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in December
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in December in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime December( this Int16 day, Int16 year )
25 | => new DateTime( year, 12, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.February.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in February
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in February in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime February( this Int16 day, Int16 year )
25 | => new DateTime( year, 2, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.November.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in November
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in November in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime November( this Int16 day, Int16 year )
25 | => new DateTime( year, 11, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/System.DateTime/FromMonth/Int16.September.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in September
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in September in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime September( this Int16 day, Int16 year )
25 | => new DateTime( year, 9, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.December.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in December
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in December in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime December( this Int32 day, Int32 year )
25 | => new DateTime( year, 12, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.February.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in February
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in February in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime February( this Int32 day, Int32 year )
25 | => new DateTime( year, 2, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.November.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in November
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in November in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime November( this Int32 day, Int32 year )
25 | => new DateTime( year, 11, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/System.DateTime/FromMonth/Int32.September.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Returns a date-time representing the specified day in September
17 | /// in the specified year.
18 | ///
19 | /// The day.
20 | /// The year.
21 | /// Return a date-time representing the specified day in September in the specified year.
22 | [Pure]
23 | [PublicAPI]
24 | public static DateTime September( this Int32 day, Int32 year )
25 | => new DateTime( year, 9, day );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Random/Random.CoinToss.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class RandomEx
14 | {
15 | ///
16 | /// Returns randomly true or false.
17 | ///
18 | /// random can not be null.
19 | /// The random to use.
20 | /// Returns true or false (random value).
21 | [Pure]
22 | [PublicAPI]
23 | public static Boolean CoinToss( [NotNull] this Random random )
24 | {
25 | random.ThrowIfNull( nameof(random) );
26 |
27 | return random.Next( 2 ) == 0;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.WildcardToRegex.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Text.RegularExpressions;
5 | using JetBrains.Annotations;
6 |
7 | #endregion
8 |
9 | namespace Extend
10 | {
11 | public static partial class StringEx
12 | {
13 | ///
14 | /// Converts the given wild-card pattern to a RegEx.
15 | ///
16 | /// A wild-card pattern.
17 | /// Returns the equivalent RegEx.
18 | [Pure]
19 | [NotNull]
20 | public static String WildcardToRegex( [NotNull] this String pattern )
21 | {
22 | pattern.ThrowIfNull( nameof(pattern) );
23 |
24 | return "^" + Regex.Escape( pattern )
25 | .Replace( @"\*", ".*" )
26 | .Replace( @"\?", "." )
27 | + "$";
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsSameDay.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Gets whether the given date-time values are the same day.
17 | ///
18 | /// The first date-time value.
19 | /// The second date-time value.
20 | /// Returns true if the given date-time values are the same day, otherwise false.
21 | [Pure]
22 | [PublicAPI]
23 | public static Boolean IsSameDay( this DateTime dateTime, DateTime otherDateTime )
24 | => dateTime.Date == otherDateTime.Date;
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.ToLower.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Converts the value of a Unicode character to its lowercase equivalent.
17 | ///
18 | /// The Unicode character to convert.
19 | ///
20 | /// The lowercase equivalent of , or the unchanged value of , if
21 | /// is already lowercase or not alphabetic.
22 | ///
23 | [PublicAPI]
24 | [Pure]
25 | public static Char ToLower( this Char c )
26 | => Char.ToLower( c );
27 | }
28 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int32/Int32.IsMultipleOf.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int32Ex
14 | {
15 | ///
16 | /// Checks if the Int32 value is a multiple of the given factor.
17 | ///
18 | /// factor is 0.
19 | /// The Int32 to check.
20 | /// The factor.
21 | /// >Returns true if the Int32 value is a multiple of the given factor.
22 | [PublicAPI]
23 | [Pure]
24 | public static Boolean IsMultipleOf( this Int32 value, Int32 factor )
25 | => value != 0 && value % factor == 0;
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.Enum/Enum.GetFlags.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text.RegularExpressions;
6 | using FluentAssertions;
7 | using Xunit;
8 |
9 | #endregion
10 |
11 | namespace Extend.Testing
12 | {
13 | public partial class EnumExTest
14 | {
15 | [Fact]
16 | public void GetFlagsTest()
17 | {
18 | const RegexOptions enumValue = RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.None;
19 | var actual = enumValue
20 | .GetFlags()
21 | .ToList();
22 |
23 | actual.Should()
24 | .HaveCount( 4 );
25 | actual.Should()
26 | .Contain( new List { RegexOptions.Compiled, RegexOptions.CultureInvariant, RegexOptions.Multiline, RegexOptions.None } );
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int16/Int16.IsMultipleOf.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int16Ex
14 | {
15 | ///
16 | /// Checks if the Int16 value is a multiple of the given factor.
17 | ///
18 | /// factor is 0.
19 | /// The Int16 to check.
20 | /// The factor.
21 | /// >Returns true if the Int16 value is a multiple of the given factor.
22 | [PublicAPI]
23 | [Pure]
24 | public static Boolean IsMultipleOf( this Int16 value, Int16 factor )
25 | => value != 0 && value % factor == 0;
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Int64/Int64.IsMultipleOf.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class Int64Ex
14 | {
15 | ///
16 | /// Checks if the Int64 value is a multiple of the given factor.
17 | ///
18 | /// factor is 0.
19 | /// The Int64 to check.
20 | /// The factor.
21 | /// >Returns true if the Int64 value is a multiple of the given factor.
22 | [PublicAPI]
23 | [Pure]
24 | public static Boolean IsMultipleOf( this Int64 value, Int64 factor )
25 | => value != 0 && value % factor == 0;
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.IsNumeric.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void IsNumericTest()
14 | {
15 | var actual = "test".IsNumeric();
16 | Assert.False( actual );
17 |
18 | actual = "1test".IsNumeric();
19 | Assert.False( actual );
20 |
21 | actual = "123".IsNumeric();
22 | Assert.True( actual );
23 | }
24 |
25 | [Fact]
26 | public void IsNumericTestNullCheck()
27 | {
28 | // ReSharper disable once AssignNullToNotNullAttribute
29 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
30 | Action test = () => StringEx.IsNumeric( null );
31 |
32 | Assert.Throws( test );
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.LastDayOfWeek.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the last day of the given week.
17 | ///
18 | /// The week to get the last day of.
19 | /// Returns the last day of the given week.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime LastDayOfWeek( this DateTime week )
23 | => week.DayOfWeek == DayOfWeek.Sunday
24 | ? new DateTime( week.Year, week.Month, week.Day )
25 | : new DateTime( week.Year, week.Month, week.Day ).AddDays( 7 - (Int32) week.DayOfWeek );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/String.RemoveNumbers.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Linq;
5 | using JetBrains.Annotations;
6 |
7 | #endregion
8 |
9 | namespace Extend
10 | {
11 | public static partial class StringEx
12 | {
13 | ///
14 | /// Removes all numbers from the given string.
15 | ///
16 | /// s can not be null.
17 | /// The input string.
18 | /// The given string without any numbers.
19 | [NotNull]
20 | [Pure]
21 | [PublicAPI]
22 | public static String RemoveNumbers( [NotNull] this String s )
23 | {
24 | s.ThrowIfNull( nameof(s) );
25 |
26 | return new String( s.ToCharArray()
27 | .Where( x => !x.IsNumber() )
28 | .ToArray() );
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.KeepLettersAndNumbers.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using Xunit;
5 |
6 | #endregion
7 |
8 | namespace Extend.Testing
9 | {
10 | public partial class StringExTest
11 | {
12 | [Fact]
13 | public void KeepLettersAndNumbersTest()
14 | {
15 | var actual = "a1b2c3".KeepLettersAndNumbers();
16 | Assert.Equal( "a1b2c3", actual );
17 |
18 | actual = "a1.b2-c3".KeepLettersAndNumbers();
19 | Assert.Equal( "a1b2c3", actual );
20 | }
21 |
22 | [Fact]
23 | public void KeepLettersAndNumbersTestNullCheck()
24 | {
25 | // ReSharper disable once AssignNullToNotNullAttribute
26 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
27 | Action test = () => StringEx.KeepLettersAndNumbers( null );
28 |
29 | Assert.Throws( test );
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/.Src/Extend/Models/AttributeDefinitionType.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class representing a type and it's attributes of a specific type.
12 | ///
13 | /// The type of the attributes.
14 | public class AttributeDefinitionType : IAttributeDefinitionType where T : Attribute
15 | {
16 | #region Implementation of IAttributeDefinitionType
17 |
18 | ///
19 | /// Gets or sets the attributes.
20 | ///
21 | /// The attributes.
22 | public IEnumerable Attributes { get; set; }
23 |
24 | ///
25 | /// Gets or sets the type.
26 | ///
27 | /// The type.
28 | public Type Type { get; set; }
29 |
30 | #endregion
31 | }
32 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.IsLastDayOfMonth.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Gets a value indicating whether the given date-time value is the last day of the month represented in
17 | /// .
18 | ///
19 | /// The date-time value.
20 | /// Returns a value of true if the given date-time value is the last day of the month.
21 | [Pure]
22 | [PublicAPI]
23 | public static Boolean IsLastDayOfMonth( this DateTime dateTime )
24 | => DateTime.DaysInMonth( dateTime.Year, dateTime.Month ) == dateTime.Day;
25 | }
26 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Object/Generic/Object.Generic.ToSingleItemArray.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using JetBrains.Annotations;
4 |
5 | #endregion
6 |
7 | namespace Extend
8 | {
9 | ///
10 | /// Class containing some extension methods for .
11 | ///
12 | public static partial class ObjectEx
13 | {
14 | ///
15 | /// Creates a array with the given value as only item.
16 | ///
17 | /// The type of the items in the array.
18 | /// The value to add to the new created array.
19 | /// Returns the new created array.
20 | [NotNull]
21 | [ItemCanBeNull]
22 | [Pure]
23 | [PublicAPI]
24 | public static T[] ToSingleItemArray( [CanBeNull] this T value )
25 | => new[]
26 | {
27 | value
28 | };
29 | }
30 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.Char/Char.ToUpper.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class CharEx
14 | {
15 | ///
16 | /// Converts the value of a Unicode character to its uppercase equivalent.
17 | ///
18 | /// The Unicode character to convert.
19 | ///
20 | /// The uppercase equivalent of , or the unchanged value of if
21 | /// is already uppercase, has no uppercase equivalent, or is not alphabetic.
22 | ///
23 | [PublicAPI]
24 | [Pure]
25 | public static Char ToUpper( this Char c )
26 | => Char.ToUpper( c );
27 | }
28 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.DateTime/DateTime.EndOfMonth.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | ///
11 | /// Class containing some extension methods for .
12 | ///
13 | public static partial class DateTimeEx
14 | {
15 | ///
16 | /// Returns the last moment ("23:59:59:999") of the month represented by the given date time value.
17 | ///
18 | /// The @this to act on.
19 | /// Returns the last moment ("23:59:59:999") of the month represented by the given date time value.
20 | [Pure]
21 | [PublicAPI]
22 | public static DateTime EndOfMonth( this DateTime month )
23 | => new DateTime( month.Year, month.Month, 1 )
24 | .AddMonths( 1 )
25 | .Subtract( 1.ToMilliseconds() );
26 | }
27 | }
--------------------------------------------------------------------------------
/.Src/Extend/System.String/ConvertSafe/String.SafeToBoolean.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using JetBrains.Annotations;
5 |
6 | #endregion
7 |
8 | namespace Extend
9 | {
10 | public static partial class StringEx
11 | {
12 | ///
13 | /// Tries to convert the specified string representation of a logical value to
14 | /// its equivalent.
15 | ///
16 | /// A string containing the value to convert.
17 | /// The default value, returned if the conversion fails.
18 | /// Returns the converted value, or the given default value if the conversion failed.
19 | [Pure]
20 | [PublicAPI]
21 | public static Boolean SafeToBoolean( [CanBeNull] this String value, Boolean defaultValue = default )
22 | => value.TryParsBoolean( out var outValue ) ? outValue : defaultValue;
23 | }
24 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/System.IO.Path/String.GetFileExtension.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using System.IO;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class StringExTest
12 | {
13 | [Fact]
14 | public void GetFileExtensionTest()
15 | {
16 | const String fielName = "test.txt";
17 | var expected = Path.GetExtension( fielName );
18 | var actual = fielName.GetFileExtension();
19 |
20 | Assert.Equal( expected, actual );
21 | }
22 |
23 | [Fact]
24 | public void GetFileExtensionTestNullCheck()
25 | {
26 | // ReSharper disable once AssignNullToNotNullAttribute
27 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
28 | Action test = () => StringEx.GetFileExtension( null );
29 |
30 | Assert.Throws( test );
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/.Src/Extend.Testing/System.String/String.ToEnum.Test.cs:
--------------------------------------------------------------------------------
1 | #region Usings
2 |
3 | using System;
4 | using FluentAssertions;
5 | using Xunit;
6 |
7 | #endregion
8 |
9 | namespace Extend.Testing
10 | {
11 | public partial class StringExTest
12 | {
13 | [Fact]
14 | public void ToEnumTest()
15 | {
16 | const DayOfWeek expected = DayOfWeek.Monday;
17 | var actual = expected.ToString()
18 | .ToEnum();
19 |
20 | actual
21 | .Should()
22 | .Be( expected );
23 | }
24 |
25 | [Fact]
26 | public void ToEnumTestNullCheck()
27 | {
28 | // ReSharper disable once AssignNullToNotNullAttribute
29 | // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
30 | Action test = () => StringEx.ToEnum( null );
31 |
32 | Assert.Throws( test );
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------