Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System;
using Xunit;

namespace Platform.Exceptions.Tests
namespace Platform.Assertions.Tests
{
public static class EnsuranceTests
{
[Fact]
public static void ArgumentNotNullEnsuranceTest()
{
// Should throw an exception (even if in neighbour "Ignore" namespace it was overridden, but here this namespace is not used)
// Should throw an exception
Assert.Throws<ArgumentNullException>(() => Ensure.Always.ArgumentNotNull<object>(null, "object"));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Diagnostics;
using Platform.Exceptions.ExtensionRoots;
using Platform.Assertions.ExtensionRoots;

namespace Platform.Exceptions.Tests.Ignore
namespace Platform.Assertions.Tests.Ignore
{
public static class EnsureExtensions
{
Expand All @@ -12,4 +12,4 @@ public static void ArgumentNotNull<TArgument>(this EnsureAlwaysExtensionRoot roo
// Override logic to do nothing (this should be used to reduce the overhead of the Ensure checks, when it is critical to performance)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;

namespace Platform.Exceptions.Tests.Ignore
namespace Platform.Assertions.Tests.Ignore
{
public static class IgnoredEnsuranceTests
{
Expand All @@ -13,4 +13,4 @@ public static void EnsuranceIgnoredTest()
Ensure.Always.ArgumentNotNull<object>(null, "object");
}
}
}
}
25 changes: 25 additions & 0 deletions csharp/Platform.Assertions.Tests/Platform.Assertions.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All" />
<PackageReference Include="coverlet.collector" Version="3.1.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Platform.Assertions\Platform.Assertions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Platform.Exceptions.ExtensionRoots;
using Platform.Assertions.ExtensionRoots;

namespace Platform.Exceptions
namespace Platform.Assertions
{
/// <summary>
/// <para>Contains two extensible classes instances that can be supplemented with static helper methods by using the extension mechanism. These methods ensure the contract compliance.</para>
Expand All @@ -20,4 +20,4 @@ public static class Ensure
/// </summary>
public static readonly EnsureOnDebugExtensionRoot OnDebug = new EnsureOnDebugExtensionRoot();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using Platform.Exceptions.ExtensionRoots;
using Platform.Assertions.ExtensionRoots;

#pragma warning disable IDE0060 // Remove unused parameter

namespace Platform.Exceptions
namespace Platform.Assertions
{
/// <summary>
/// <para>Provides a set of extension methods for <see cref="EnsureAlwaysExtensionRoot"/> and <see cref="EnsureOnDebugExtensionRoot"/> objects.</para>
Expand Down Expand Up @@ -161,7 +161,7 @@ public static void ArgumentMeetsCriteria<TArgument>(this EnsureAlwaysExtensionRo

/// <summary>
/// <para>Ensures that the argument meets the criteria. This check is performed only for DEBUG build configuration.</para>
/// <para>Гарантирует, что аргумент соответствует критерию. Эта проверка выполняется только для конфигурации сборки DEBUG.</para>
/// <para>Гарантirует, что аргумент соответствует критерию. Эта проверка выполняется только для конфигурации сборки DEBUG.</para>
/// </summary>
/// <typeparam name="TArgument"><para>Type of argument.</para><para>Тип аргумента.</para></typeparam>
/// <param name="root"><para>The extension root to which this method is bound.</para><para>Корень-расширения, к которому привязан этот метод.</para></param>
Expand All @@ -172,4 +172,4 @@ public static void ArgumentMeetsCriteria<TArgument>(this EnsureAlwaysExtensionRo

#endregion
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Platform.Exceptions.ExtensionRoots
namespace Platform.Assertions.ExtensionRoots
{
/// <summary>
/// <para>Represents the extension root class for Ensure.Always.</para>
Expand All @@ -7,4 +7,4 @@ namespace Platform.Exceptions.ExtensionRoots
public class EnsureAlwaysExtensionRoot
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Platform.Exceptions.ExtensionRoots
namespace Platform.Assertions.ExtensionRoots
{
/// <summary>
/// <para>Represents the extension root class for Ensure.OnDebug.</para>
Expand All @@ -7,4 +7,4 @@ namespace Platform.Exceptions.ExtensionRoots
public class EnsureOnDebugExtensionRoot
{
}
}
}
38 changes: 38 additions & 0 deletions csharp/Platform.Assertions/Platform.Assertions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>LinksPlatform's Platform.Assertions Class Library</Description>
<Copyright>Konstantin Diachenko</Copyright>
<AssemblyTitle>Platform.Assertions</AssemblyTitle>
<VersionPrefix>0.1.0</VersionPrefix>
<Authors>Konstantin Diachenko</Authors>
<TargetFramework>net8</TargetFramework>
<AssemblyName>Platform.Assertions</AssemblyName>
<PackageId>Platform.Assertions</PackageId>
<PackageTags>LinksPlatform;Assertions;Ensure;EnsureExtensions;ExtensionRoots;EnsureAlwaysExtensionRoot;EnsureOnDebugExtensionRoot</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png</PackageIconUrl>
<PackageProjectUrl>https://linksplatform.github.io/Assertions</PackageProjectUrl>
<PackageLicenseExpression>Unlicense</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/linksplatform/Assertions</RepositoryUrl>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<LangVersion>latest</LangVersion>
<PackageReleaseNotes>Initial release with assertion functionality moved from Platform.Exceptions.</PackageReleaseNotes>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

</Project>
28 changes: 28 additions & 0 deletions csharp/Platform.Exceptions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.Exceptions", "Plat
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.Exceptions.Tests", "Platform.Exceptions.Tests\Platform.Exceptions.Tests.csproj", "{1B2D5587-35A6-42B4-A3DA-271AEFBD4DDD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.Assertions", "Platform.Assertions\Platform.Assertions.csproj", "{B5A89421-3053-41A9-B0C5-ED1308631615}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.Assertions.Tests", "Platform.Assertions.Tests\Platform.Assertions.Tests.csproj", "{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -40,6 +44,30 @@ Global
{1B2D5587-35A6-42B4-A3DA-271AEFBD4DDD}.Release|x64.Build.0 = Release|Any CPU
{1B2D5587-35A6-42B4-A3DA-271AEFBD4DDD}.Release|x86.ActiveCfg = Release|Any CPU
{1B2D5587-35A6-42B4-A3DA-271AEFBD4DDD}.Release|x86.Build.0 = Release|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Debug|x64.ActiveCfg = Debug|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Debug|x64.Build.0 = Debug|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Debug|x86.ActiveCfg = Debug|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Debug|x86.Build.0 = Debug|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Release|Any CPU.Build.0 = Release|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Release|x64.ActiveCfg = Release|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Release|x64.Build.0 = Release|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Release|x86.ActiveCfg = Release|Any CPU
{B5A89421-3053-41A9-B0C5-ED1308631615}.Release|x86.Build.0 = Release|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Debug|x64.ActiveCfg = Debug|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Debug|x64.Build.0 = Debug|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Debug|x86.ActiveCfg = Debug|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Debug|x86.Build.0 = Debug|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Release|Any CPU.Build.0 = Release|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Release|x64.ActiveCfg = Release|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Release|x64.Build.0 = Release|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Release|x86.ActiveCfg = Release|Any CPU
{2B2D5587-35A6-42B4-A3DA-271AEFBD4DDE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 5 additions & 1 deletion csharp/Platform.Exceptions/Platform.Exceptions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TargetFramework>net8</TargetFramework>
<AssemblyName>Platform.Exceptions</AssemblyName>
<PackageId>Platform.Exceptions</PackageId>
<PackageTags>LinksPlatform;Exceptions;Ensure;EnsureExtensions;ExceptionExtensions;IgnoredExceptions;Throw;ThrowExtensions;ExtensionRoots;EnsureAlwaysExtensionRoot;EnsureOnDebugExtensionRoot;ThrowExtensionRoot</PackageTags>
<PackageTags>LinksPlatform;Exceptions;ExceptionExtensions;IgnoredExceptions;Throw;ThrowExtensions;ExtensionRoots;ThrowExtensionRoot</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/linksplatform/Documentation/18469f4d033ee9a5b7b84caab9c585acab2ac519/doc/Avatar-rainbow-icon-64x64.png</PackageIconUrl>
<PackageProjectUrl>https://linksplatform.github.io/Exceptions</PackageProjectUrl>
<PackageLicenseExpression>Unlicense</PackageLicenseExpression>
Expand All @@ -35,6 +35,10 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../Platform.Assertions/Platform.Assertions.csproj" />
</ItemGroup>



</Project>
Loading