From 9a4d4e4bbb4c6dc6d8e70af1475da1297d3fa888 Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Sun, 21 Nov 2021 03:10:19 +0300
Subject: [PATCH 1/9] Implement protobuf support

---
 NClient.sln                                   |  4 ++
 .../ProtobufSerializationExtensions.cs        | 45 +++++++++++++
 .../UsingProtobufSerializationExtensions.cs   | 65 +++++++++++++++++++
 ...nt.Providers.Serialization.Protobuf.csproj | 49 ++++++++++++++
 .../ProtobufSerializer.cs                     | 48 ++++++++++++++
 .../ProtobufSerializerProvider.cs             | 34 ++++++++++
 .../ProtobufSerializerSettings.cs             | 16 +++++
 7 files changed, 261 insertions(+)
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs

diff --git a/NClient.sln b/NClient.sln
index bf29e7e9c..92c845876 100644
--- a/NClient.sln
+++ b/NClient.sln
@@ -93,6 +93,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Api.Rest"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Api.Rest.Tests", "tests\NClient.Providers\NClient.Providers.Api.Rest.Tests\NClient.Providers.Api.Rest.Tests.csproj", "{27521108-9C67-44AE-885C-3BE343421955}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Serialization.Protobuf", "src\NClient.Providers\NClient.Providers.Serialization.Protobuf\NClient.Providers.Serialization.Protobuf.csproj", "{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Serialization.Protobuf.Tests", "tests\NClient.Providers\NClient.Providers.Serialization.Protobuf.Tests\NClient.Providers.Serialization.Protobuf.Tests.csproj", "{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs
new file mode 100644
index 000000000..75abc2659
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs
@@ -0,0 +1,45 @@
+using NClient.Common.Helpers;
+
+namespace NClient.Providers.Serialization.Protobuf.Extensions
+{
+    public static class ProtobufSerializationExtensions
+    {
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> WithNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
+            this INClientOptionalBuilder<TClient, TRequest, TResponse> optionalBuilder) 
+            where TClient : class
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider());
+        }
+
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> WithNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
+            this INClientOptionalBuilder<TClient, TRequest, TResponse> optionalBuilder,
+            ProtobufSerializerSettings protobufSerializerSettings)
+            where TClient : class
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider(protobufSerializerSettings));
+        }
+
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> WithNewtonsoftJsonSerialization<TRequest, TResponse>(
+            this INClientFactoryOptionalBuilder<TRequest, TResponse> optionalBuilder)
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider());
+        }
+
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> WithNewtonsoftJsonSerialization<TRequest, TResponse>(
+            this INClientFactoryOptionalBuilder<TRequest, TResponse> optionalBuilder,
+            ProtobufSerializerSettings protobufSerializerSettings)
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider(protobufSerializerSettings));
+        }
+    }
+}
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs
new file mode 100644
index 000000000..c059df09c
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs
@@ -0,0 +1,65 @@
+using NClient.Common.Helpers;
+
+namespace NClient.Providers.Serialization.Protobuf.Extensions
+{
+    public static class UsingProtobufSerializationExtensions
+    {
+        /// <summary>
+        /// Sets Protobuf based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="serializationBuilder"></param>
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
+            this INClientSerializationBuilder<TClient, TRequest, TResponse> serializationBuilder)
+            where TClient : class
+        {
+            Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
+
+            return serializationBuilder.UsingCustomSerializer(new ProtobufSerializerProvider());
+        }
+
+        /// <summary>
+        /// Sets Protobuf based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="serializationBuilder"></param>
+        /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
+            this INClientSerializationBuilder<TClient, TRequest, TResponse> serializationBuilder,
+            ProtobufSerializerSettings protobufSerializerSettings)
+            where TClient : class
+        {
+            Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+
+            return serializationBuilder
+                .UsingCustomSerializer(new ProtobufSerializerProvider(protobufSerializerSettings));
+        }
+
+        /// <summary>
+        /// Sets Protobuf based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="serializationBuilder"></param>
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingNewtonsoftJsonSerialization<TRequest, TResponse>(
+            this INClientFactorySerializationBuilder<TRequest, TResponse> serializationBuilder)
+        {
+            Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
+
+            return serializationBuilder.UsingCustomSerializer(new ProtobufSerializerProvider());
+        }
+
+        /// <summary>
+        /// Sets Newtonsoft.Json based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="serializationBuilder"></param>
+        /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingNewtonsoftJsonSerialization<TRequest, TResponse>(
+            this INClientFactorySerializationBuilder<TRequest, TResponse> serializationBuilder,
+            ProtobufSerializerSettings protobufSerializerSettings)
+        {
+            Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+
+            return serializationBuilder
+                .UsingCustomSerializer(new ProtobufSerializerProvider(protobufSerializerSettings));
+        }
+    }
+}
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
new file mode 100644
index 000000000..09e2661d7
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
@@ -0,0 +1,49 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+
+    <PropertyGroup>
+        <PackageId>$(AssemblyName)</PackageId>
+        <VersionPrefix>$(VersionPrefix)</VersionPrefix>
+        <VersionSuffix>$(VersionSuffix)</VersionSuffix>
+        <PackageIcon>logo.png</PackageIcon>
+        <PackageProjectUrl>https://nclient.github.io</PackageProjectUrl>
+        <RepositoryUrl>https://github.com/nclient/nclient</RepositoryUrl>
+        <RepositoryType>git</RepositoryType>
+        <PackageTags>NClient;NClient.Providers;NClient.Providers.Serialization;Protobuf;Google</PackageTags>
+        <Description>The provider that allows you to use the Protobuf serializer.</Description>
+        <Authors>kingmidas74</Authors>
+        <PackageLicenseFile>LICENSE</PackageLicenseFile>
+        <IsPackable>true</IsPackable>
+    </PropertyGroup>
+
+    <PropertyGroup>
+        <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
+        <LangVersion>9.0</LangVersion>
+        <Nullable>enable</Nullable>
+        <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+        <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
+        <Configurations>Debug;Release</Configurations>
+        <Platforms>AnyCPU</Platforms>
+        <OutputPath>$(SolutionDir)/bin/src/$(Configuration)/$(AssemblyName)</OutputPath>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\NClient\NClient.Abstractions\NClient.Abstractions.csproj" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <None Include="..\..\..\logo.png" Pack="true" PackagePath="" />
+        <None Include="..\..\..\LICENSE" Pack="true" PackagePath="" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <Compile Include="..\..\NClient\NClient.Common\Helpers\Ensure.cs">
+            <Link>Common\Ensure.cs</Link>
+        </Compile>
+    </ItemGroup>
+
+    <ItemGroup>
+      <PackageReference Include="protobuf-net" Version="3.0.101" />
+    </ItemGroup>
+
+</Project>
\ No newline at end of file
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
new file mode 100644
index 000000000..d5959281e
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
@@ -0,0 +1,48 @@
+using System;
+using System.IO;
+using NClient.Common.Helpers;
+using ProtoBuf;
+
+namespace NClient.Providers.Serialization.Protobuf
+{
+    public class ProtobufSerializer : ISerializer
+    {
+        private readonly ProtobufSerializerSettings _protobufSerializerSettings;
+
+        public string ContentType { get; } = String.Empty;
+
+        public ProtobufSerializer(ProtobufSerializerSettings protobufSerializerSettings)
+        {
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+            Ensure.IsNotNullOrEmpty(protobufSerializerSettings.ContentTypeHeader, nameof(protobufSerializerSettings.ContentTypeHeader));
+
+            _protobufSerializerSettings = protobufSerializerSettings;
+            ContentType = _protobufSerializerSettings.ContentTypeHeader;
+        }
+
+        public object? Deserialize(string source, Type returnType)
+        {
+            Ensure.IsNotNull(source, nameof(source));
+            Ensure.IsNotNull(returnType, nameof(returnType));
+
+            byte[] bytes = new byte[source.Length];
+            Buffer.BlockCopy(source.ToCharArray(), 0, bytes, 0, bytes.Length);
+            
+            using var memoryStream = new MemoryStream(bytes);
+            return Serializer.Deserialize(returnType, memoryStream);
+        }
+
+        public string Serialize<T>(T? value)
+        {
+            Ensure.IsNotNull(value, nameof(value));
+            
+            using var memoryStream = new MemoryStream();
+            Serializer.Serialize(memoryStream, value);
+            var serializedBytes = memoryStream.ToArray();
+            
+            var chars = new char[serializedBytes.Length];
+            Buffer.BlockCopy(serializedBytes, 0, chars, 0, serializedBytes.Length);
+            return new string(chars);
+        }
+    }
+}
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs
new file mode 100644
index 000000000..a49acdc14
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs
@@ -0,0 +1,34 @@
+using Microsoft.Extensions.Logging;
+using NClient.Common.Helpers;
+
+namespace NClient.Providers.Serialization.Protobuf
+{
+    public class ProtobufSerializerProvider : ISerializerProvider
+    {
+        private readonly ProtobufSerializerSettings _protobufSerializerSettings;
+
+        /// <summary>
+        /// Creates the Protobuf serializer provider.
+        /// </summary>
+        public ProtobufSerializerProvider()
+        {
+            _protobufSerializerSettings = new ProtobufSerializerSettings("application/proto");
+        }
+
+        /// <summary>
+        /// Creates the Newtonsoft.Json based serializer provider.
+        /// </summary>
+        /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
+        public ProtobufSerializerProvider(ProtobufSerializerSettings protobufSerializerSettings)
+        {
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+
+            _protobufSerializerSettings = protobufSerializerSettings;
+        }
+
+        public ISerializer Create(ILogger? logger)
+        {
+            return new ProtobufSerializer(_protobufSerializerSettings);
+        }
+    }
+}
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs
new file mode 100644
index 000000000..987e97459
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs
@@ -0,0 +1,16 @@
+using NClient.Common.Helpers;
+
+namespace NClient.Providers.Serialization.Protobuf
+{
+    public record ProtobufSerializerSettings
+    {
+        public string ContentTypeHeader { get; } = string.Empty;
+
+        public ProtobufSerializerSettings(string contentTypeHeader)
+        {
+            Ensure.IsNotNullOrEmpty(contentTypeHeader, nameof(contentTypeHeader));
+
+            ContentTypeHeader = contentTypeHeader;
+        }
+    }
+}

From 953ee07c4611927f92af3586f3059218690db6c1 Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Sun, 21 Nov 2021 03:10:41 +0300
Subject: [PATCH 2/9] Test cover for protobuf addon

---
 NClient.sln                                   | 14 +++
 .../Models/NotProto.cs                        | 14 +++
 .../Models/Point.cs                           | 13 +++
 ...viders.Serialization.Protobuf.Tests.csproj | 27 ++++++
 .../ProtobufSerializerTest.cs                 | 85 +++++++++++++++++++
 5 files changed, 153 insertions(+)
 create mode 100644 tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs
 create mode 100644 tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs
 create mode 100644 tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj
 create mode 100644 tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs

diff --git a/NClient.sln b/NClient.sln
index 92c845876..f5b9d902d 100644
--- a/NClient.sln
+++ b/NClient.sln
@@ -283,6 +283,18 @@ Global
 		{27521108-9C67-44AE-885C-3BE343421955}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{27521108-9C67-44AE-885C-3BE343421955}.Release|Any CPU.Build.0 = Release|Any CPU
 		{27521108-9C67-44AE-885C-3BE343421955}.TestRelease|Any CPU.ActiveCfg = Release|Any CPU
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}.TestRelease|Any CPU.ActiveCfg = Debug|Any CPU
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}.TestRelease|Any CPU.Build.0 = Debug|Any CPU
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}.TestRelease|Any CPU.ActiveCfg = Debug|Any CPU
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}.TestRelease|Any CPU.Build.0 = Debug|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -322,6 +334,8 @@ Global
 		{FA3D9C32-CC55-4D39-8F49-5FC3040EBD78} = {B1BCB5AE-6A5E-49F7-A00A-6B2931DF628C}
 		{0BB4D666-9C18-4F71-A0A3-88DCC275139D} = {DCB997FD-29F4-48D9-8348-093761DA42E7}
 		{27521108-9C67-44AE-885C-3BE343421955} = {B1BCB5AE-6A5E-49F7-A00A-6B2931DF628C}
+		{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772} = {DCB997FD-29F4-48D9-8348-093761DA42E7}
+		{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3} = {B1BCB5AE-6A5E-49F7-A00A-6B2931DF628C}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {244A4C58-8FA7-496C-ABCF-72F333149A20}
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs
new file mode 100644
index 000000000..0151f5e44
--- /dev/null
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs
@@ -0,0 +1,14 @@
+namespace NClient.Providers.Serialization.Protobuf.Tests.Models
+{
+    public readonly struct NotProto
+    {
+        public readonly int X;
+        public readonly int Y;
+
+        public NotProto(int x, int y)
+        {
+            X = x;
+            Y = y;
+        }
+    }
+}
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs
new file mode 100644
index 000000000..bc9c2a618
--- /dev/null
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs
@@ -0,0 +1,13 @@
+using ProtoBuf;
+
+namespace NClient.Providers.Serialization.Protobuf.Tests.Models
+{
+    [ProtoContract]
+    public struct Point
+    {
+        [ProtoMember(1)]
+        public int X { get; set; }
+        [ProtoMember(2)]
+        public int Y { get; set; }
+    }
+}
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj
new file mode 100644
index 000000000..6da62c687
--- /dev/null
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj
@@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <TargetFrameworks>net462;net472;net48;net5.0;net6.0;netcoreapp3.1</TargetFrameworks>
+        <LangVersion>9.0</LangVersion>
+        <Nullable>enable</Nullable>
+        <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+        <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
+        <IsPackable>false</IsPackable>
+        <Configurations>Debug;Release</Configurations>
+        <Platforms>AnyCPU</Platforms>
+        <OutputPath>$(SolutionDir)/bin/test/$(Configuration)/$(AssemblyName)</OutputPath>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\..\src\NClient.Providers\NClient.Providers.Serialization.Protobuf\NClient.Providers.Serialization.Protobuf.csproj" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\NClient.Testing\NClient.Testing.Common\NClient.Testing.Common.csproj" />
+    </ItemGroup>
+
+</Project>
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
new file mode 100644
index 000000000..feaffa8b2
--- /dev/null
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections;
+using System.IO;
+using FluentAssertions;
+using NClient.Providers.Serialization.Protobuf.Tests.Models;
+using NUnit.Framework;
+using ProtoBuf;
+
+namespace NClient.Providers.Serialization.Protobuf.Tests
+{
+    [Parallelizable]
+    public class ProtobufSerializerTest
+    {
+        public static readonly IEnumerable SerializationValidTestCases = new[]
+        {
+            new TestCaseData(new Point{ X = 1, Y = 2 }, new Point{ X = 1, Y = 2 }, typeof(Point)),
+            new TestCaseData(new Point{ X = 2, Y = 2 }, new Point{ X = 2, Y = 2 }, typeof(Point))
+        };
+
+        public static readonly IEnumerable DeserializationValidTestCases = new[]
+        {
+            new TestCaseData(new Point{ X = 1, Y = 2 }, new Point{ X = 1, Y = 2 }, typeof(Point))
+        };
+
+        public static readonly IEnumerable NotValidTestCases = new[]
+        {
+            new TestCaseData(new NotProto(1, 2), new NotProto(1, 2), typeof(NotProto))
+        };
+
+        [TestCaseSource(nameof(SerializationValidTestCases))]
+        public void Serialize_ValidValues_NotThrow(object obj, object expectedResult, Type type)
+        {
+            var serializer = new ProtobufSerializerProvider().Create(logger: null);
+
+            var serializerString = serializer.Serialize(obj);
+            byte[] bytes = new byte[serializerString.Length];
+            Buffer.BlockCopy(serializerString.ToCharArray(), 0, bytes, 0, bytes.Length);
+
+            var actualResult = Serializer.Deserialize(type, new MemoryStream(bytes));
+
+            actualResult.Should().BeEquivalentTo(expectedResult);
+        }
+        
+        [Test]
+        public void Serialize_Null_ThrowArgumentNullException()
+        {
+            var serializer = new ProtobufSerializerProvider().Create(logger: null);
+
+            serializer
+                .Invoking(x => x.Serialize((int?) null))
+                .Should()
+                .ThrowExactly<ArgumentNullException>();
+        }
+
+        [TestCaseSource(nameof(DeserializationValidTestCases))]
+        public void Deserialize_ValidValues_NotThrow(object sourceObject, object expectedResult, Type type)
+        {
+            var serializer = new ProtobufSerializerProvider().Create(logger: null);
+
+            using var memoryStream = new MemoryStream();
+            Serializer.Serialize(memoryStream, sourceObject);
+            
+            var serializedBytes = memoryStream.ToArray();
+            
+            var chars = new char[serializedBytes.Length];
+            Buffer.BlockCopy(serializedBytes, 0, chars, 0, serializedBytes.Length);
+            var serializedString = new string(chars);
+            
+            var actualResult = serializer.Deserialize(serializedString, type);
+
+            actualResult.Should().BeEquivalentTo(expectedResult);
+        }
+
+        [Test]
+        public void Deserialize_Null_ThrowArgumentNullException()
+        {
+            var serializer = new ProtobufSerializerProvider().Create(logger: null);
+
+            serializer
+                .Invoking(x => x.Deserialize(null!, typeof(string)))
+                .Should()
+                .ThrowExactly<ArgumentNullException>();
+        }
+    }
+}

From ae7bb7feb797e13c95480b0eea71b224065b0134 Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Sun, 21 Nov 2021 11:00:28 +0300
Subject: [PATCH 3/9] Extrude converters to common lib

---
 .../NClient.Common/Helpers/Converters.cs      | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 src/NClient/NClient.Common/Helpers/Converters.cs

diff --git a/src/NClient/NClient.Common/Helpers/Converters.cs b/src/NClient/NClient.Common/Helpers/Converters.cs
new file mode 100644
index 000000000..7b00b13eb
--- /dev/null
+++ b/src/NClient/NClient.Common/Helpers/Converters.cs
@@ -0,0 +1,21 @@
+using System;
+
+namespace NClient.Common.Helpers
+{
+    public static class Converters
+    {
+        public static string GetString(byte[] source)
+        {
+            var chars = new char[source.Length];
+            Buffer.BlockCopy(source, 0, chars, 0, source.Length);
+            return new string(chars);
+        }
+
+        public static byte[] GetBytes(string source)
+        {
+            byte[] result = new byte[source.Length];
+            Buffer.BlockCopy(source.ToCharArray(), 0, result, 0, result.Length);
+            return result;
+        }
+    }
+}

From 00f6f68feac659382bd2cec5c42a4e1cf1e0ff2b Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Sun, 21 Nov 2021 11:08:35 +0300
Subject: [PATCH 4/9] #299 Replace all converts to common lib file

---
 .../NClient.Providers.Serialization.Protobuf.csproj       | 3 +++
 .../ProtobufSerializer.cs                                 | 8 ++------
 .../ProtobufSerializerTest.cs                             | 8 +++-----
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
index 09e2661d7..c6e5645aa 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
@@ -40,6 +40,9 @@
         <Compile Include="..\..\NClient\NClient.Common\Helpers\Ensure.cs">
             <Link>Common\Ensure.cs</Link>
         </Compile>
+        <Compile Include="..\..\NClient\NClient.Common\Helpers\Converters.cs">
+            <Link>Common\Converters.cs</Link>
+        </Compile>
     </ItemGroup>
 
     <ItemGroup>
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
index d5959281e..70aff94f1 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
@@ -25,8 +25,7 @@ public ProtobufSerializer(ProtobufSerializerSettings protobufSerializerSettings)
             Ensure.IsNotNull(source, nameof(source));
             Ensure.IsNotNull(returnType, nameof(returnType));
 
-            byte[] bytes = new byte[source.Length];
-            Buffer.BlockCopy(source.ToCharArray(), 0, bytes, 0, bytes.Length);
+            var bytes = Converters.GetBytes(source);
             
             using var memoryStream = new MemoryStream(bytes);
             return Serializer.Deserialize(returnType, memoryStream);
@@ -38,11 +37,8 @@ public string Serialize<T>(T? value)
             
             using var memoryStream = new MemoryStream();
             Serializer.Serialize(memoryStream, value);
-            var serializedBytes = memoryStream.ToArray();
             
-            var chars = new char[serializedBytes.Length];
-            Buffer.BlockCopy(serializedBytes, 0, chars, 0, serializedBytes.Length);
-            return new string(chars);
+            return Converters.GetString(memoryStream.ToArray());
         }
     }
 }
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
index feaffa8b2..290f8a9d0 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
@@ -2,6 +2,7 @@
 using System.Collections;
 using System.IO;
 using FluentAssertions;
+using NClient.Common.Helpers;
 using NClient.Providers.Serialization.Protobuf.Tests.Models;
 using NUnit.Framework;
 using ProtoBuf;
@@ -33,8 +34,7 @@ public void Serialize_ValidValues_NotThrow(object obj, object expectedResult, Ty
             var serializer = new ProtobufSerializerProvider().Create(logger: null);
 
             var serializerString = serializer.Serialize(obj);
-            byte[] bytes = new byte[serializerString.Length];
-            Buffer.BlockCopy(serializerString.ToCharArray(), 0, bytes, 0, bytes.Length);
+            byte[] bytes = Converters.GetBytes(serializerString);
 
             var actualResult = Serializer.Deserialize(type, new MemoryStream(bytes));
 
@@ -62,9 +62,7 @@ public void Deserialize_ValidValues_NotThrow(object sourceObject, object expecte
             
             var serializedBytes = memoryStream.ToArray();
             
-            var chars = new char[serializedBytes.Length];
-            Buffer.BlockCopy(serializedBytes, 0, chars, 0, serializedBytes.Length);
-            var serializedString = new string(chars);
+            var serializedString = Converters.GetString(serializedBytes);
             
             var actualResult = serializer.Deserialize(serializedString, type);
 

From eb178041a3e095a8e17cf2eef882d8dd568250c8 Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Sun, 21 Nov 2021 15:42:32 +0300
Subject: [PATCH 5/9] Fix copypaste mistakes and add "post" version tests.

---
 NClient.sln                                   |  4 +-
 .../ProtobufSerializationExtensions.cs        | 77 +++++++++++++++++++
 .../UsingProtobufSerializationExtensions.cs   | 22 +++---
 ...Serialization.Protobuf.ProtobufNet.csproj} |  2 +-
 .../ProtobufSerializer.cs                     |  2 +-
 .../ProtobufSerializerProvider.cs             |  2 +-
 .../ProtobufSerializerSettings.cs             |  2 +-
 .../ProtobufSerializationExtensions.cs        | 45 -----------
 .../NClient.Packages.Tests.csproj             |  1 +
 .../NClient.Packages.Tests/VersionTest.cs     |  4 +
 .../Models/NotProto.cs                        |  2 +-
 .../Models/Point.cs                           |  2 +-
 ...ization.Protobuf.ProtobufNet.Tests.csproj} |  2 +-
 .../ProtobufSerializerTest.cs                 |  4 +-
 14 files changed, 104 insertions(+), 67 deletions(-)
 create mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs
 rename src/NClient.Providers/{NClient.Providers.Serialization.Protobuf => NClient.Providers.Serialization.Protobuf.ProtobufNet}/Extensions/UsingProtobufSerializationExtensions.cs (67%)
 rename src/NClient.Providers/{NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj => NClient.Providers.Serialization.Protobuf.ProtobufNet/NClient.Providers.Serialization.Protobuf.ProtobufNet.csproj} (97%)
 rename src/NClient.Providers/{NClient.Providers.Serialization.Protobuf => NClient.Providers.Serialization.Protobuf.ProtobufNet}/ProtobufSerializer.cs (95%)
 rename src/NClient.Providers/{NClient.Providers.Serialization.Protobuf => NClient.Providers.Serialization.Protobuf.ProtobufNet}/ProtobufSerializerProvider.cs (94%)
 rename src/NClient.Providers/{NClient.Providers.Serialization.Protobuf => NClient.Providers.Serialization.Protobuf.ProtobufNet}/ProtobufSerializerSettings.cs (85%)
 delete mode 100644 src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs
 rename tests/NClient.Providers/{NClient.Providers.Serialization.Protobuf.Tests => NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests}/Models/NotProto.cs (73%)
 rename tests/NClient.Providers/{NClient.Providers.Serialization.Protobuf.Tests => NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests}/Models/Point.cs (72%)
 rename tests/NClient.Providers/{NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj => NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj} (89%)
 rename tests/NClient.Providers/{NClient.Providers.Serialization.Protobuf.Tests => NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests}/ProtobufSerializerTest.cs (95%)

diff --git a/NClient.sln b/NClient.sln
index f5b9d902d..cb239b085 100644
--- a/NClient.sln
+++ b/NClient.sln
@@ -93,9 +93,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Api.Rest"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Api.Rest.Tests", "tests\NClient.Providers\NClient.Providers.Api.Rest.Tests\NClient.Providers.Api.Rest.Tests.csproj", "{27521108-9C67-44AE-885C-3BE343421955}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Serialization.Protobuf", "src\NClient.Providers\NClient.Providers.Serialization.Protobuf\NClient.Providers.Serialization.Protobuf.csproj", "{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Serialization.Protobuf.ProtobufNet", "src\NClient.Providers\NClient.Providers.Serialization.Protobuf.ProtobufNet\NClient.Providers.Serialization.Protobuf.ProtobufNet.csproj", "{EC0A387A-AAEE-44EF-8AB0-6EF2D745E772}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Serialization.Protobuf.Tests", "tests\NClient.Providers\NClient.Providers.Serialization.Protobuf.Tests\NClient.Providers.Serialization.Protobuf.Tests.csproj", "{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests", "tests\NClient.Providers\NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests\NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj", "{B10DCE0F-7BF1-4D0C-AAFD-F4D1D0CBD4A3}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs
new file mode 100644
index 000000000..053fdab01
--- /dev/null
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs
@@ -0,0 +1,77 @@
+using NClient.Common.Helpers;
+
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Extensions
+{
+    public static class ProtobufSerializationExtensions
+    {
+        /// <summary>
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="optionalBuilder"></param>
+        /// <typeparam name="TClient"></typeparam>
+        /// <typeparam name="TRequest"></typeparam>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <returns></returns>
+        public static INClientOptionalBuilder<TClient, TClient, TResponse> WithProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientOptionalBuilder<TClient, TClient, TResponse> optionalBuilder) 
+            where TClient : class
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider());
+        }
+
+        /// <summary>
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="optionalBuilder"></param>
+        /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
+        /// <typeparam name="TClient"></typeparam>
+        /// <typeparam name="TRequest"></typeparam>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <returns></returns>
+        public static INClientOptionalBuilder<TClient, TClient, TResponse> WithProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientOptionalBuilder<TClient, TClient, TResponse> optionalBuilder,
+            ProtobufSerializerSettings protobufSerializerSettings)
+            where TClient : class
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider(protobufSerializerSettings));
+        }
+
+        /// <summary>
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="optionalBuilder"></param>
+        /// <typeparam name="TRequest"></typeparam>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <returns></returns>
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> WithProtobufNetSerialization<TRequest, TResponse>(
+            this INClientFactoryOptionalBuilder<TRequest, TResponse> optionalBuilder)
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider());
+        }
+
+        /// <summary>
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// </summary>
+        /// <param name="optionalBuilder"></param>
+        /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
+        /// <typeparam name="TRequest"></typeparam>
+        /// <typeparam name="TResponse"></typeparam>
+        /// <returns></returns>
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> WithProtobufNetSerialization<TRequest, TResponse>(
+            this INClientFactoryOptionalBuilder<TRequest, TResponse> optionalBuilder,
+            ProtobufSerializerSettings protobufSerializerSettings)
+        {
+            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
+            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
+            
+            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider(protobufSerializerSettings));
+        }
+    }
+}
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs
similarity index 67%
rename from src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs
rename to src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs
index c059df09c..72bea5008 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/UsingProtobufSerializationExtensions.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs
@@ -1,15 +1,15 @@
 using NClient.Common.Helpers;
 
-namespace NClient.Providers.Serialization.Protobuf.Extensions
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Extensions
 {
     public static class UsingProtobufSerializationExtensions
     {
         /// <summary>
-        /// Sets Protobuf based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
         /// </summary>
         /// <param name="serializationBuilder"></param>
-        public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
-            this INClientSerializationBuilder<TClient, TRequest, TResponse> serializationBuilder)
+        public static INClientOptionalBuilder<TClient, TClient, TResponse> UsingProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientSerializationBuilder<TClient, TClient, TResponse> serializationBuilder)
             where TClient : class
         {
             Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
@@ -18,12 +18,12 @@ public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingNewtons
         }
 
         /// <summary>
-        /// Sets Protobuf based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
         /// </summary>
         /// <param name="serializationBuilder"></param>
         /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
-        public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
-            this INClientSerializationBuilder<TClient, TRequest, TResponse> serializationBuilder,
+        public static INClientOptionalBuilder<TClient, TClient, TResponse> UsingProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientSerializationBuilder<TClient, TClient, TResponse> serializationBuilder,
             ProtobufSerializerSettings protobufSerializerSettings)
             where TClient : class
         {
@@ -35,10 +35,10 @@ public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingNewtons
         }
 
         /// <summary>
-        /// Sets Protobuf based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
         /// </summary>
         /// <param name="serializationBuilder"></param>
-        public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingNewtonsoftJsonSerialization<TRequest, TResponse>(
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingProtobufNetSerialization<TRequest, TResponse>(
             this INClientFactorySerializationBuilder<TRequest, TResponse> serializationBuilder)
         {
             Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
@@ -47,11 +47,11 @@ public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingNewtonsof
         }
 
         /// <summary>
-        /// Sets Newtonsoft.Json based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
+        /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
         /// </summary>
         /// <param name="serializationBuilder"></param>
         /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
-        public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingNewtonsoftJsonSerialization<TRequest, TResponse>(
+        public static INClientFactoryOptionalBuilder<TRequest, TResponse> UsingProtobufNetSerialization<TRequest, TResponse>(
             this INClientFactorySerializationBuilder<TRequest, TResponse> serializationBuilder,
             ProtobufSerializerSettings protobufSerializerSettings)
         {
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/NClient.Providers.Serialization.Protobuf.ProtobufNet.csproj
similarity index 97%
rename from src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
rename to src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/NClient.Providers.Serialization.Protobuf.ProtobufNet.csproj
index c6e5645aa..42cc0b27e 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/NClient.Providers.Serialization.Protobuf.csproj
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/NClient.Providers.Serialization.Protobuf.ProtobufNet.csproj
@@ -9,7 +9,7 @@
         <PackageProjectUrl>https://nclient.github.io</PackageProjectUrl>
         <RepositoryUrl>https://github.com/nclient/nclient</RepositoryUrl>
         <RepositoryType>git</RepositoryType>
-        <PackageTags>NClient;NClient.Providers;NClient.Providers.Serialization;Protobuf;Google</PackageTags>
+        <PackageTags>NClient;NClient.Providers;NClient.Providers.Serialization;Protobuf;Google;protobuf-net</PackageTags>
         <Description>The provider that allows you to use the Protobuf serializer.</Description>
         <Authors>kingmidas74</Authors>
         <PackageLicenseFile>LICENSE</PackageLicenseFile>
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializer.cs
similarity index 95%
rename from src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
rename to src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializer.cs
index 70aff94f1..7162fe062 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializer.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializer.cs
@@ -3,7 +3,7 @@
 using NClient.Common.Helpers;
 using ProtoBuf;
 
-namespace NClient.Providers.Serialization.Protobuf
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet
 {
     public class ProtobufSerializer : ISerializer
     {
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializerProvider.cs
similarity index 94%
rename from src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs
rename to src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializerProvider.cs
index a49acdc14..ffafe993a 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerProvider.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializerProvider.cs
@@ -1,7 +1,7 @@
 using Microsoft.Extensions.Logging;
 using NClient.Common.Helpers;
 
-namespace NClient.Providers.Serialization.Protobuf
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet
 {
     public class ProtobufSerializerProvider : ISerializerProvider
     {
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializerSettings.cs
similarity index 85%
rename from src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs
rename to src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializerSettings.cs
index 987e97459..a196fb708 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/ProtobufSerializerSettings.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/ProtobufSerializerSettings.cs
@@ -1,6 +1,6 @@
 using NClient.Common.Helpers;
 
-namespace NClient.Providers.Serialization.Protobuf
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet
 {
     public record ProtobufSerializerSettings
     {
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs
deleted file mode 100644
index 75abc2659..000000000
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf/Extensions/ProtobufSerializationExtensions.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using NClient.Common.Helpers;
-
-namespace NClient.Providers.Serialization.Protobuf.Extensions
-{
-    public static class ProtobufSerializationExtensions
-    {
-        public static INClientOptionalBuilder<TClient, TRequest, TResponse> WithNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
-            this INClientOptionalBuilder<TClient, TRequest, TResponse> optionalBuilder) 
-            where TClient : class
-        {
-            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
-            
-            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider());
-        }
-
-        public static INClientOptionalBuilder<TClient, TRequest, TResponse> WithNewtonsoftJsonSerialization<TClient, TRequest, TResponse>(
-            this INClientOptionalBuilder<TClient, TRequest, TResponse> optionalBuilder,
-            ProtobufSerializerSettings protobufSerializerSettings)
-            where TClient : class
-        {
-            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
-            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
-            
-            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider(protobufSerializerSettings));
-        }
-
-        public static INClientFactoryOptionalBuilder<TRequest, TResponse> WithNewtonsoftJsonSerialization<TRequest, TResponse>(
-            this INClientFactoryOptionalBuilder<TRequest, TResponse> optionalBuilder)
-        {
-            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
-            
-            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider());
-        }
-
-        public static INClientFactoryOptionalBuilder<TRequest, TResponse> WithNewtonsoftJsonSerialization<TRequest, TResponse>(
-            this INClientFactoryOptionalBuilder<TRequest, TResponse> optionalBuilder,
-            ProtobufSerializerSettings protobufSerializerSettings)
-        {
-            Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
-            Ensure.IsNotNull(protobufSerializerSettings, nameof(protobufSerializerSettings));
-            
-            return optionalBuilder.WithCustomSerialization(new ProtobufSerializerProvider(protobufSerializerSettings));
-        }
-    }
-}
diff --git a/tests/NClient.Packages/NClient.Packages.Tests/NClient.Packages.Tests.csproj b/tests/NClient.Packages/NClient.Packages.Tests/NClient.Packages.Tests.csproj
index 22cce9601..ace9b2784 100644
--- a/tests/NClient.Packages/NClient.Packages.Tests/NClient.Packages.Tests.csproj
+++ b/tests/NClient.Packages/NClient.Packages.Tests/NClient.Packages.Tests.csproj
@@ -28,6 +28,7 @@
         <PackageReference Include="NClient.Providers.Serialization.Json.System" Version="*-*"/>
         <PackageReference Include="NClient.Providers.Serialization.Json.Newtonsoft" Version="*-*"/>
         <PackageReference Include="NClient.Providers.Serialization.Xml.System" Version="*-*"/>
+        <PackageReference Include="NClient.Providers.Serialization.Protobuf.ProtobufNet" Version="*-*"/>
         <PackageReference Include="NClient.Extensions.DependencyInjection" Version="*-*"/>
     </ItemGroup>
 
diff --git a/tests/NClient.Packages/NClient.Packages.Tests/VersionTest.cs b/tests/NClient.Packages/NClient.Packages.Tests/VersionTest.cs
index 9755d3dde..80692fcf8 100644
--- a/tests/NClient.Packages/NClient.Packages.Tests/VersionTest.cs
+++ b/tests/NClient.Packages/NClient.Packages.Tests/VersionTest.cs
@@ -56,6 +56,10 @@ public void NClient_Providers_Serialization_Json_System() =>
         public void NClient_Providers_Serialization_Json_Newtonsoft() =>
             PackagesVersionProvider.GetCurrent("NClient.Providers.Serialization.Json.Newtonsoft").Should().Be(PackagesVersionProvider.GetNew());
         
+        [Test]
+        public void NClient_Providers_Serialization_Protobuf_ProtobufNet() =>
+            PackagesVersionProvider.GetCurrent("NClient.Providers.Serialization.Protobuf.ProtobufNet").Should().Be(PackagesVersionProvider.GetNew());
+        
         [Test]
         public void NClient_Providers_Serialization_Xml_System() =>
             PackagesVersionProvider.GetCurrent("NClient.Providers.Serialization.Xml.System").Should().Be(PackagesVersionProvider.GetNew());
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/Models/NotProto.cs
similarity index 73%
rename from tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs
rename to tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/Models/NotProto.cs
index 0151f5e44..7fe21ef6a 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/NotProto.cs
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/Models/NotProto.cs
@@ -1,4 +1,4 @@
-namespace NClient.Providers.Serialization.Protobuf.Tests.Models
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.Models
 {
     public readonly struct NotProto
     {
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/Models/Point.cs
similarity index 72%
rename from tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs
rename to tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/Models/Point.cs
index bc9c2a618..c0b350bd2 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/Models/Point.cs
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/Models/Point.cs
@@ -1,6 +1,6 @@
 using ProtoBuf;
 
-namespace NClient.Providers.Serialization.Protobuf.Tests.Models
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.Models
 {
     [ProtoContract]
     public struct Point
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
similarity index 89%
rename from tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj
rename to tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
index 6da62c687..a1d42b9fa 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/NClient.Providers.Serialization.Protobuf.Tests.csproj
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
@@ -17,7 +17,7 @@
     </ItemGroup>
 
     <ItemGroup>
-        <ProjectReference Include="..\..\..\src\NClient.Providers\NClient.Providers.Serialization.Protobuf\NClient.Providers.Serialization.Protobuf.csproj" />
+        <ProjectReference Include="..\..\..\src\NClient.Providers\NClient.Providers.Serialization.Protobuf.ProtobufNet\NClient.Providers.Serialization.Protobuf.ProtobufNet.csproj" />
     </ItemGroup>
 
     <ItemGroup>
diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/ProtobufSerializerTest.cs
similarity index 95%
rename from tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
rename to tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/ProtobufSerializerTest.cs
index 290f8a9d0..91a318eb4 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.Tests/ProtobufSerializerTest.cs
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/ProtobufSerializerTest.cs
@@ -3,11 +3,11 @@
 using System.IO;
 using FluentAssertions;
 using NClient.Common.Helpers;
-using NClient.Providers.Serialization.Protobuf.Tests.Models;
+using NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.Models;
 using NUnit.Framework;
 using ProtoBuf;
 
-namespace NClient.Providers.Serialization.Protobuf.Tests
+namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests
 {
     [Parallelizable]
     public class ProtobufSerializerTest

From 022cd24f27eb7beb384c20957b417b1d1286d907 Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Thu, 25 Nov 2021 00:37:38 +0300
Subject: [PATCH 6/9] Adjust namespaces

---
 .../Extensions/ProtobufSerializationExtensions.cs   | 13 ++++++++-----
 .../UsingProtobufSerializationExtensions.cs         | 13 ++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs
index 053fdab01..b98fbb1c7 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/ProtobufSerializationExtensions.cs
@@ -1,6 +1,9 @@
 using NClient.Common.Helpers;
+using NClient.Providers.Serialization;
+using NClient.Providers.Serialization.Protobuf.ProtobufNet;
 
-namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Extensions
+// ReSharper disable once CheckNamespace
+namespace NClient
 {
     public static class ProtobufSerializationExtensions
     {
@@ -12,8 +15,8 @@ public static class ProtobufSerializationExtensions
         /// <typeparam name="TRequest"></typeparam>
         /// <typeparam name="TResponse"></typeparam>
         /// <returns></returns>
-        public static INClientOptionalBuilder<TClient, TClient, TResponse> WithProtobufNetSerialization<TClient, TRequest, TResponse>(
-            this INClientOptionalBuilder<TClient, TClient, TResponse> optionalBuilder) 
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> WithProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientOptionalBuilder<TClient, TRequest, TResponse> optionalBuilder) 
             where TClient : class
         {
             Ensure.IsNotNull(optionalBuilder, nameof(optionalBuilder));
@@ -30,8 +33,8 @@ public static INClientOptionalBuilder<TClient, TClient, TResponse> WithProtobufN
         /// <typeparam name="TRequest"></typeparam>
         /// <typeparam name="TResponse"></typeparam>
         /// <returns></returns>
-        public static INClientOptionalBuilder<TClient, TClient, TResponse> WithProtobufNetSerialization<TClient, TRequest, TResponse>(
-            this INClientOptionalBuilder<TClient, TClient, TResponse> optionalBuilder,
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> WithProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientOptionalBuilder<TClient, TRequest, TResponse> optionalBuilder,
             ProtobufSerializerSettings protobufSerializerSettings)
             where TClient : class
         {
diff --git a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs
index 72bea5008..1c691c231 100644
--- a/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs
+++ b/src/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet/Extensions/UsingProtobufSerializationExtensions.cs
@@ -1,6 +1,9 @@
 using NClient.Common.Helpers;
+using NClient.Providers.Serialization;
+using NClient.Providers.Serialization.Protobuf.ProtobufNet;
 
-namespace NClient.Providers.Serialization.Protobuf.ProtobufNet.Extensions
+// ReSharper disable once CheckNamespace
+namespace NClient
 {
     public static class UsingProtobufSerializationExtensions
     {
@@ -8,8 +11,8 @@ public static class UsingProtobufSerializationExtensions
         /// Sets ProtobufNet based <see cref="ISerializerProvider"/> used to create instance of <see cref="ISerializer"/>.
         /// </summary>
         /// <param name="serializationBuilder"></param>
-        public static INClientOptionalBuilder<TClient, TClient, TResponse> UsingProtobufNetSerialization<TClient, TRequest, TResponse>(
-            this INClientSerializationBuilder<TClient, TClient, TResponse> serializationBuilder)
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientSerializationBuilder<TClient, TRequest, TResponse> serializationBuilder)
             where TClient : class
         {
             Ensure.IsNotNull(serializationBuilder, nameof(serializationBuilder));
@@ -22,8 +25,8 @@ public static INClientOptionalBuilder<TClient, TClient, TResponse> UsingProtobuf
         /// </summary>
         /// <param name="serializationBuilder"></param>
         /// <param name="protobufSerializerSettings">The settings to be used with <see cref="ProtobufSerializer"/>.</param>
-        public static INClientOptionalBuilder<TClient, TClient, TResponse> UsingProtobufNetSerialization<TClient, TRequest, TResponse>(
-            this INClientSerializationBuilder<TClient, TClient, TResponse> serializationBuilder,
+        public static INClientOptionalBuilder<TClient, TRequest, TResponse> UsingProtobufNetSerialization<TClient, TRequest, TResponse>(
+            this INClientSerializationBuilder<TClient, TRequest, TResponse> serializationBuilder,
             ProtobufSerializerSettings protobufSerializerSettings)
             where TClient : class
         {

From c1109fdb68313b04fd477193ee645c241824fd9c Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Thu, 25 Nov 2021 00:41:46 +0300
Subject: [PATCH 7/9] Hide converters from public

---
 src/NClient/NClient.Common/Helpers/Converters.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/NClient/NClient.Common/Helpers/Converters.cs b/src/NClient/NClient.Common/Helpers/Converters.cs
index 7b00b13eb..36b7c36dd 100644
--- a/src/NClient/NClient.Common/Helpers/Converters.cs
+++ b/src/NClient/NClient.Common/Helpers/Converters.cs
@@ -2,7 +2,7 @@
 
 namespace NClient.Common.Helpers
 {
-    public static class Converters
+    internal static class Converters
     {
         public static string GetString(byte[] source)
         {

From b39b3d22780dc1dd5859f50d468afe4651b29fcd Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Thu, 25 Nov 2021 00:46:24 +0300
Subject: [PATCH 8/9] Include Converters to tests

---
 ...oviders.Serialization.Protobuf.ProtobufNet.Tests.csproj | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
index a1d42b9fa..4848babc9 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
@@ -24,4 +24,11 @@
         <ProjectReference Include="..\..\NClient.Testing\NClient.Testing.Common\NClient.Testing.Common.csproj" />
     </ItemGroup>
 
+
+    <ItemGroup>
+        <Compile Include="..\..\..\src\NClient\NClient.Common\Helpers\Converters.cs">
+            <Link>Common\Converters.cs</Link>
+        </Compile>
+    </ItemGroup>
+
 </Project>

From e59726c243fb0fb22332acee6e9d3a510899bfa0 Mon Sep 17 00:00:00 2001
From: Kingmidas74 <kingmidas1992@gmail.com>
Date: Thu, 25 Nov 2021 00:46:47 +0300
Subject: [PATCH 9/9] remove empty row

---
 ...ent.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
index 4848babc9..8a5e36059 100644
--- a/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
+++ b/tests/NClient.Providers/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests/NClient.Providers.Serialization.Protobuf.ProtobufNet.Tests.csproj
@@ -24,7 +24,6 @@
         <ProjectReference Include="..\..\NClient.Testing\NClient.Testing.Common\NClient.Testing.Common.csproj" />
     </ItemGroup>
 
-
     <ItemGroup>
         <Compile Include="..\..\..\src\NClient\NClient.Common\Helpers\Converters.cs">
             <Link>Common\Converters.cs</Link>
