diff --git a/Architecture/Synergy.Architecture.Diagrams/Api/ApiDescription.cs b/Architecture/Synergy.Architecture.Diagrams/Api/ApiDescription.cs index fe3052e..bc5df78 100644 --- a/Architecture/Synergy.Architecture.Diagrams/Api/ApiDescription.cs +++ b/Architecture/Synergy.Architecture.Diagrams/Api/ApiDescription.cs @@ -4,12 +4,13 @@ using System.Runtime.InteropServices; using System.Text; using JetBrains.Annotations; +using Synergy.Architecture.Diagrams.Extensions; namespace Synergy.Architecture.Diagrams.Api { // TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: remove this class from here - check what it is used for - public static class ApiDescription + internal static class ApiDescription { static readonly BindingFlags bindingFlags = BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; diff --git a/Architecture/Synergy.Architecture.Diagrams/TechnicalBlueprint.cs b/Architecture/Synergy.Architecture.Diagrams/Documentation/TechnicalBlueprint.cs similarity index 98% rename from Architecture/Synergy.Architecture.Diagrams/TechnicalBlueprint.cs rename to Architecture/Synergy.Architecture.Diagrams/Documentation/TechnicalBlueprint.cs index 9e7b66b..3f61589 100644 --- a/Architecture/Synergy.Architecture.Diagrams/TechnicalBlueprint.cs +++ b/Architecture/Synergy.Architecture.Diagrams/Documentation/TechnicalBlueprint.cs @@ -2,7 +2,7 @@ using Synergy.Architecture.Diagrams.Sequence; using Synergy.Contracts; -namespace Synergy.Architecture.Diagrams; +namespace Synergy.Architecture.Diagrams.Documentation; public class TechnicalBlueprint { diff --git a/Architecture/Synergy.Architecture.Diagrams/ReflectionExtensions.cs b/Architecture/Synergy.Architecture.Diagrams/Extensions/ReflectionExtensions.cs similarity index 95% rename from Architecture/Synergy.Architecture.Diagrams/ReflectionExtensions.cs rename to Architecture/Synergy.Architecture.Diagrams/Extensions/ReflectionExtensions.cs index f687759..3ec240a 100644 --- a/Architecture/Synergy.Architecture.Diagrams/ReflectionExtensions.cs +++ b/Architecture/Synergy.Architecture.Diagrams/Extensions/ReflectionExtensions.cs @@ -1,6 +1,6 @@ using System.Reflection; -namespace Synergy.Architecture.Diagrams; +namespace Synergy.Architecture.Diagrams.Extensions; internal static class ReflectionExtensions { @@ -23,7 +23,7 @@ public static bool IsAssignableTo(this Type type, string assignableType) public static Attribute? GetCustomAttribute(this Type type, string attributeType) => type.GetCustomAttributes().FirstOrDefault(a => a.GetType().IsAssignableTo(attributeType)); - + public static Attribute? GetCustomAttribute(this MethodInfo method, string attributeType) => method.GetCustomAttributes().FirstOrDefault(a => a.GetType().IsAssignableTo(attributeType)); diff --git a/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagram.cs b/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagram.cs index 1236977..42905a8 100644 --- a/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagram.cs +++ b/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagram.cs @@ -3,6 +3,7 @@ using System.Text; using Synergy.Architecture.Annotations.Diagrams.Sequence; using Synergy.Architecture.Diagrams.Api; +using Synergy.Architecture.Diagrams.Documentation; using Synergy.Contracts; using Synergy.Reflection; diff --git a/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagramUrl.cs b/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagramUrl.cs index 5026c4a..cc30125 100644 --- a/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagramUrl.cs +++ b/Architecture/Synergy.Architecture.Diagrams/Sequence/SequenceDiagramUrl.cs @@ -4,6 +4,8 @@ using PlantUml.Net; using Synergy.Architecture.Annotations.Diagrams.Sequence; using Synergy.Architecture.Diagrams.Api; +using Synergy.Architecture.Diagrams.Documentation; +using Synergy.Architecture.Diagrams.Extensions; using Synergy.Contracts; using Synergy.Reflection; diff --git a/Architecture/Synergy.Architecture.Diagrams/Synergy.Architecture.Diagrams.csproj b/Architecture/Synergy.Architecture.Diagrams/Synergy.Architecture.Diagrams.csproj index cb54c51..5d9c132 100644 --- a/Architecture/Synergy.Architecture.Diagrams/Synergy.Architecture.Diagrams.csproj +++ b/Architecture/Synergy.Architecture.Diagrams/Synergy.Architecture.Diagrams.csproj @@ -22,12 +22,6 @@ - - - CustomAttributeExtensions.cs - - - @@ -37,4 +31,10 @@ + + + Extensions\CustomAttributeExtensions.cs + + + diff --git a/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md b/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md index 6c28af0..543c598 100644 --- a/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md +++ b/Architecture/Synergy.Architecture.Tests/Architecture/Debt/Todos.Technical.Debt.verified.md @@ -1,9 +1,6 @@ # Technical Debt for Synergy.Contracts -Total: 3 - -## [SequenceDiagramActivationAttribute.cs](../../../Synergy.Architecture.Annotations/Diagrams/Sequence/SequenceDiagramActivationAttribute.cs) -- TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: Add optional attributes when compilation constant CODE_ANALYSIS (or other) is present +Total: 2 ## [ApiDescription.cs](../../../Synergy.Architecture.Diagrams/Api/ApiDescription.cs) - TODO: Marcin Celej [from: Marcin Celej on: 08-04-2023]: remove this class from here - check what it is used for diff --git a/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.cs b/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.cs index 2df98dd..3ea6639 100644 --- a/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.cs +++ b/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.cs @@ -1,5 +1,6 @@ using Synergy.Architecture.Annotations.Diagrams.Sequence; using Synergy.Architecture.Diagrams; +using Synergy.Architecture.Diagrams.Documentation; using Synergy.Documentation.Api; namespace Synergy.Architecture.Tests.Architecture.Public; diff --git a/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.of.Synergy.Architecture.Diagrams.verified.md b/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.of.Synergy.Architecture.Diagrams.verified.md index bde0c34..9a10151 100644 --- a/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.of.Synergy.Architecture.Diagrams.verified.md +++ b/Architecture/Synergy.Architecture.Tests/Architecture/Public/Api.of.Synergy.Architecture.Diagrams.verified.md @@ -11,32 +11,6 @@ type: Type ) : TAttribute[] [Extension] -## TechnicalBlueprint (class) - - ctor() - - Add( - diagram: params SequenceDiagram[] [ParamArray] - ) : TechnicalBlueprint - - Add( - diagram: IEnumerable - ) : TechnicalBlueprint - - Intro( - markdown: string - ) : TechnicalBlueprint - - Register() : TechnicalBlueprint [NullableContext] - - Register( - interface: Type, - services: IServiceProvider - ) : TechnicalBlueprint - - Register( - interface: Type, - implementation: Type - ) : TechnicalBlueprint - - Render() : string - - TechnicalBlueprint.Titled( - title: string - ) : TechnicalBlueprint - - ToString() : string - ## Sequence.SequenceDiagram (record) : IEquatable - Actor: SequenceDiagramActor [Nullable] { get; set; } - Components: TechnicalBlueprint+DiagramComponents? { get; set; } @@ -110,30 +84,33 @@ - GenerateDiagramContent() : StringBuilder - GenerateDiagramUrl() : string -## Api.ApiDescription (abstract class) - - ApiDescription.For( - method: MethodInfo, - withAttributes: bool [Optional] - ) : string - - ApiDescription.GenerateFor( - assembly: Assembly - ) : string - - ApiDescription.GenerateFor( - types: IEnumerable, - description: StringBuilder? [Nullable, Optional], - assemblyName: string? [Nullable, Optional] - ) : string - - ApiDescription.GetTypeName( - method: MethodInfo - ) : string - - ApiDescription.GetTypeName( - parameter: ParameterInfo - ) : string - - ApiDescription.GetTypeName( - type: Type - ) : string +## Documentation.TechnicalBlueprint (class) + - ctor() + - Add( + diagram: params SequenceDiagram[] [ParamArray] + ) : TechnicalBlueprint + - Add( + diagram: IEnumerable + ) : TechnicalBlueprint + - Intro( + markdown: string + ) : TechnicalBlueprint + - Register() : TechnicalBlueprint [NullableContext] + - Register( + interface: Type, + services: IServiceProvider + ) : TechnicalBlueprint + - Register( + interface: Type, + implementation: Type + ) : TechnicalBlueprint + - Render() : string + - TechnicalBlueprint.Titled( + title: string + ) : TechnicalBlueprint + - ToString() : string -## TechnicalBlueprint+DiagramComponents (class) +## Documentation.TechnicalBlueprint+DiagramComponents (class) - ctor() - Register() : void [NullableContext] - Register( diff --git a/Reflection/Synergy.Reflection/CustomAttributeExtensions.cs b/Reflection/Synergy.Reflection/CustomAttributeExtensions.cs index 0c370c6..c7e9f80 100644 --- a/Reflection/Synergy.Reflection/CustomAttributeExtensions.cs +++ b/Reflection/Synergy.Reflection/CustomAttributeExtensions.cs @@ -127,9 +127,9 @@ private static T[] GetInheritedAttributes([NotNull] IEnumerable allAt Fail.IfArgumentNull(allAttributes, nameof(allAttributes)); T[] attributes = allAttributes - .Where(a => a is T) - .Cast() - .ToArray(); + .Where(a => a is T) + .Cast() + .ToArray(); Fail.IfCollectionContainsNull(attributes, $"Attributes collection on {name}"); diff --git a/Web/Sample/Synergy.Sample.Web.API.Tests/Architecture/Diagrams.cs b/Web/Sample/Synergy.Sample.Web.API.Tests/Architecture/Diagrams.cs index 3ea4d08..41a0ea5 100644 --- a/Web/Sample/Synergy.Sample.Web.API.Tests/Architecture/Diagrams.cs +++ b/Web/Sample/Synergy.Sample.Web.API.Tests/Architecture/Diagrams.cs @@ -2,6 +2,7 @@ using System.IO; using System.Threading.Tasks; using Synergy.Architecture.Diagrams; +using Synergy.Architecture.Diagrams.Documentation; using Synergy.Architecture.Diagrams.Sequence; using Synergy.Documentation.Code; using Synergy.Sample.Web.API.Controllers; diff --git a/Web/Sample/Synergy.Sample.Web.API.Tests/Users/Users.md b/Web/Sample/Synergy.Sample.Web.API.Tests/Users/Users.md index 93d95f3..b8d35ce 100644 --- a/Web/Sample/Synergy.Sample.Web.API.Tests/Users/Users.md +++ b/Web/Sample/Synergy.Sample.Web.API.Tests/Users/Users.md @@ -95,7 +95,7 @@ Content-Length: 129 ### 2.2. Get created user pointed by "Location" header (1 request) -### 2.2.2. Request to [Get user located at http://localhost/api/v1/users/42dcb695c2c241b6aef90281aa2cf9d7] +### 2.2.2. Request to [Get user located at http://localhost/api/v1/users/e1efd892e55746e7a9199de1493ebd42] - Request ``` @@ -137,7 +137,7 @@ Content-Length: 129 ### 3.1. Get user by id (1 request) -### 3.1.1. Request to [Get user with id "42dcb695c2c241b6aef90281aa2cf9d7"] +### 3.1.1. Request to [Get user with id "e1efd892e55746e7a9199de1493ebd42"] - Request ``` @@ -391,7 +391,7 @@ Content-Length: 351 ### 6.1. Delete user by id (1 request) -### 6.1.1. Request to [Delete user with id "42dcb695c2c241b6aef90281aa2cf9d7"] +### 6.1.1. Request to [Delete user with id "e1efd892e55746e7a9199de1493ebd42"] - Request ``` @@ -418,7 +418,7 @@ Content-Length: 2 ### 6.2. Try to get the deleted user (1 request) -### 6.2.2. Request to [Get user with id "42dcb695c2c241b6aef90281aa2cf9d7"] +### 6.2.2. Request to [Get user with id "e1efd892e55746e7a9199de1493ebd42"] - Request ```