Skip to content

Commit

Permalink
#18: Updated .NET versions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinCelej committed Jul 4, 2022
1 parent f2bf9c0 commit ca78231
Show file tree
Hide file tree
Showing 17 changed files with 459 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RunCodeAnalysis>false</RunCodeAnalysis>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
Expand All @@ -20,8 +22,12 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Synergy.Contracts\Synergy.Contracts.csproj" />
<ProjectReference Include="..\Synergy.Documentation\Synergy.Documentation.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Requirements" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## DesignByContractViolationException : Exception
- TargetSite: MethodBase { get; }
- StackTrace: string { get; }
- Message: string? [Nullable] { get; }
- Data: IDictionary? [Nullable] { get; }
- InnerException: Exception { get; }
- HelpLink: string { get; set; }
- Source: string { get; set; }
- HResult: int { get; set; }
- StackTrace: string { get; }

## Fail
- Fail.IfTooLong(
Expand Down Expand Up @@ -139,13 +139,13 @@
) : DateTime [Extension, AssertionMethod]
- Fail.BecauseEnumOutOfRange<T>(
value: T
) : DesignByContractViolationException [NotNull, Pure]
) : DesignByContractViolationException? [NullableContext, NotNull, Pure]
- Fail.IfEnumNotDefined<T>(
value: object [NotNull, NotNull]
) : Void
- Fail.IfEnumNotDefined<T>(
value: T
) : Void
) : Void? [NullableContext]
- Fail.FailIfEnumOutOfRange<T>(
value: Enum [NotNull, NotNull],
name: string [NotNull, NotNull]
Expand Down Expand Up @@ -201,8 +201,8 @@
) : T [Extension, NotNull, AssertionMethod, ContractAnnotation]
- Fail.OrFail<T>(
value: Nullable`1,
name: string [NotNull, NotNull]
) : T [Extension, ContractAnnotation]
name: string? [Nullable, NotNull, NotNull]
) : T? [NullableContext, Extension, ContractAnnotation]
- Fail.NotNull<T>(
value: T [CanBeNull, AssertionCondition, NoEnumeration],
name: string [NotNull, NotNull]
Expand Down Expand Up @@ -247,7 +247,7 @@
argumentName: string [NotNull, NotNull]
) : Void [AssertionMethod, ContractAnnotation]
- Fail.OrFailIfWhiteSpace(
value: string [CanBeNull, AssertionCondition, NoEnumeration],
value: string? [Nullable, AssertionCondition, NoEnumeration],
name: string [NotNull, NotNull]
) : string [Extension, NotNull, AssertionMethod, ContractAnnotation]
- Fail.IfWhitespace(
Expand All @@ -270,22 +270,23 @@
description: string
) : Principle [MustUseReturnValue]
- Business.When(
preCondition: bool
) : Precondition [MustUseReturnValue]
preCondition: bool,
expression: string [CallerArgumentExpression, Optional]
) : Precondition? [NullableContext, MustUseReturnValue]
- Business.Requires(
condition: bool
) : Requirement [MustUseReturnValue]

## Requirements.BusinessRuleViolationException : Exception
- Requirement: Requirement { get; }
- TargetSite: MethodBase { get; }
- StackTrace: string { get; }
- Message: string? [Nullable] { get; }
- Data: IDictionary? [Nullable] { get; }
- InnerException: Exception { get; }
- HelpLink: string { get; set; }
- Source: string { get; set; }
- HResult: int { get; set; }
- StackTrace: string { get; }

## Requirements.Business+Precondition (struct)
- Met: bool { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName="")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName="")]
namespace Synergy.Contracts
{
[System.Serializable]
Expand Down Expand Up @@ -207,7 +207,7 @@ namespace Synergy.Contracts
[JetBrains.Annotations.ContractAnnotation("value: null => halt; value: notnull => notnull")]
[JetBrains.Annotations.NotNull]
[return: System.Diagnostics.CodeAnalysis.NotNull]
public static string OrFailIfWhiteSpace([JetBrains.Annotations.AssertionCondition(JetBrains.Annotations.AssertionConditionType.IS_NOT_NULL)] [JetBrains.Annotations.CanBeNull] [JetBrains.Annotations.NoEnumeration] this string value, [JetBrains.Annotations.NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name) { }
public static string OrFailIfWhiteSpace([JetBrains.Annotations.AssertionCondition(JetBrains.Annotations.AssertionConditionType.IS_NOT_NULL)] [JetBrains.Annotations.NoEnumeration] this string? value, [JetBrains.Annotations.NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name) { }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "HeapView.BoxingAllocation")]
public readonly struct Violation
Expand All @@ -230,7 +230,7 @@ namespace Synergy.Contracts.Requirements
[JetBrains.Annotations.MustUseReturnValue]
public static Synergy.Contracts.Requirements.Business.Principle Rule(string description) { }
[JetBrains.Annotations.MustUseReturnValue]
public static Synergy.Contracts.Requirements.Business.Precondition When(bool preCondition) { }
public static Synergy.Contracts.Requirements.Business.Precondition When(bool preCondition, [System.Runtime.CompilerServices.CallerArgumentExpression("preCondition")] string? expression = null) { }
public interface IPrecondition
{
bool Met { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ namespace Synergy.Contracts.Test.Requirements
{
public class BusinessDocumentation : BusinessTest
{
public static string? Read(string method)
{
return ClassReader.ReadMethodBody(method);
}

[Fact]
public void General()
{
Expand Down Expand Up @@ -57,6 +62,8 @@ private void Step1Sample()
yield return new Markdown.Paragraph("This will throw `NotImplementedException` for sure. But we have not finished our job yet.");
}



private void Step2Sample(int withdrawLimit, int withdrawAmount)
{
Business.Rule("When withdraw limit is set, withdrawn amount cannot exceed the limit")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Synergy.Contracts.Requirements;
using Synergy.Contracts.Test.Documentation;

namespace Synergy.Contracts.Test.Requirements
{
partial class BusinessUsage
{
private static string? Read(string method)
{
return ClassReader.ReadMethodBody(method);
}

public void Step1Sample()
{
Business.Rule("When withdraw limit is set, withdrawn amount cannot exceed the limit")
.Throws(new NotImplementedException("NOT IMPLEMENTED"));
}
}
}
Loading

0 comments on commit ca78231

Please sign in to comment.