diff --git a/docs/assets/images/icon.svg b/docs/assets/images/icon.svg index 747492e..f604ce6 100644 --- a/docs/assets/images/icon.svg +++ b/docs/assets/images/icon.svg @@ -86,4 +86,4 @@ l-27 41 0 583 c0 321 1 583 2 583 2 0 31 -21 65 -46z m6106 -740 c63 -18 111 - + \ No newline at end of file diff --git a/src/ProxyR.Core/Extensions/ReflectionExtensions.cs b/src/ProxyR.Core/Extensions/ReflectionExtensions.cs index e1e60a3..ddfda8f 100644 --- a/src/ProxyR.Core/Extensions/ReflectionExtensions.cs +++ b/src/ProxyR.Core/Extensions/ReflectionExtensions.cs @@ -6,6 +6,9 @@ namespace ProxyR.Core.Extensions { + /// + /// Provides extension methods for reflection-related operations. + /// public static class ReflectionExtensions { /// diff --git a/src/ProxyR.Core/Extensions/StringExtensions.cs b/src/ProxyR.Core/Extensions/StringExtensions.cs index a1257ab..e73c740 100644 --- a/src/ProxyR.Core/Extensions/StringExtensions.cs +++ b/src/ProxyR.Core/Extensions/StringExtensions.cs @@ -6,6 +6,9 @@ namespace ProxyR.Core.Extensions { + /// + /// Provides extension methods for string operations. + /// public static class StringExtensions { /// diff --git a/tests/ProxyR.Abstractions.Tests/DataTableExtensionsTests.cs b/tests/ProxyR.Abstractions.Tests/DataTableExtensionsTests.cs index 98cd993..59ebee5 100644 --- a/tests/ProxyR.Abstractions.Tests/DataTableExtensionsTests.cs +++ b/tests/ProxyR.Abstractions.Tests/DataTableExtensionsTests.cs @@ -126,7 +126,7 @@ private class TestEntity public int Id { get; set; } [MaxLength(50)] [Required] - public string Name { get; set; } + public string? Name { get; set; } public int Age { get; set; } } } diff --git a/tests/ProxyR.Abstractions.Tests/SqlTests.cs b/tests/ProxyR.Abstractions.Tests/SqlTests.cs index b06ec2c..d7d64b4 100644 --- a/tests/ProxyR.Abstractions.Tests/SqlTests.cs +++ b/tests/ProxyR.Abstractions.Tests/SqlTests.cs @@ -1,10 +1,5 @@ -using Humanizer; -using Microsoft.VisualStudio.TestPlatform.Utilities; -using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using ProxyR.Abstractions.Builder; -using ProxyR.Abstractions.Execution; -using System.ComponentModel; -using System.Linq.Expressions; namespace ProxyR.Abstractions.Tests { @@ -127,11 +122,11 @@ public void ParenthesisLines_ShouldReturnCorrectResult() [Theory] [InlineData(new object[] { "value1", 2 }, "'value1', 2")] [InlineData(new object[] { "value2", 3, true }, "'value2', 3, 1")] - [InlineData(new object[] { null }, "NULL")] - public void Values_ShouldReturnCorrectResult(object[] testData, string expected) + [InlineData(new object?[] { null }, "NULL")] + public void Values_ShouldReturnCorrectResult(object?[] testData, string expected) { // Arrange - var values = (IEnumerable)testData; + var values = (IEnumerable)testData; // Act var result = Sql.Values(values); @@ -144,7 +139,7 @@ public void Values_ShouldReturnCorrectResult(object[] testData, string expected) public void Values_WhenObject_ShouldReturnCorrectResult() { // Arrange - var values = (IEnumerable)new object[] { new JValue(123), new JValue(2.5f), new JValue("string"), new JValue(true), new JValue(DateTime.Parse("2023-05-01")), new JValue(Guid.Parse("e4279bc6-9e39-486a-9565-284d33b66b84")), new JValue(new byte[] { 0x01, 0x02, 0x03 }) }; + var values = new object?[] { new JValue(123), new JValue(2.5f), new JValue("string"), new JValue(true), new JValue(DateTime.Parse("2023-05-01")), new JValue(Guid.Parse("e4279bc6-9e39-486a-9565-284d33b66b84")), new JValue(new byte[] { 0x01, 0x02, 0x03 }) }; var expected = "123, 2.5, 'string', 1, '2023-05-01 00:00:00.000', 'e4279bc6-9e39-486a-9565-284d33b66b84', CONVERT(VARBINARY(MAX), '0x010203', 1)"; // Act @@ -159,14 +154,14 @@ public void Values_WhenObject_ShouldReturnCorrectResult() [InlineData(123, "123")] [InlineData(2.5f, "2.5")] [InlineData(true, "1")] - [InlineData(null, "NULL")] + [InlineData((object?)null, "NULL")] [InlineData("string with 'single quote'", "'string with ''single quote'''")] [InlineData("string with newline\n", "'string with newline\n'")] [InlineData("string with carriage return\r", "'string with carriage return\r'")] [InlineData("string with tab\t", "'string with tab\t'")] [InlineData("string with backslash\\", "'string with backslash\\'")] [InlineData("2023-05-01T00:00:00Z", "'2023-05-01T00:00:00Z'")] - public void Quote_ShouldReturnCorrectResult(object input, string expected) + public void Quote_ShouldReturnCorrectResult(object? input, string expected) { // Act var result = Sql.Quote(input); @@ -193,7 +188,8 @@ public void BytesToHex_ShouldReturnCorrectResult(byte[] input, string expected) public void SelectQuoted_ShouldReturnCorrectResult() { // Arrange - var values = new object[] { "value1", 2, 3.5f, null, new JValue(DateTime.Parse("2023-05-01")), new JValue(true), new byte[] { 0x01, 0x02, 0x03 }, Guid.Parse("e4279bc6-9e39-486a-9565-284d33b66b84") }; + var values = new object?[] { "value1", 2, 3.5f, null, new JValue(DateTime.Parse("2023-05-01")), new JValue(true), new byte[] { 0x01, 0x02, 0x03 }, Guid.Parse("e4279bc6-9e39-486a-9565-284d33b66b84") }; + var expected = new[] { "'value1'", "2", "3.5", "NULL", "'2023-05-01 00:00:00.000'", "1", "CONVERT(VARBINARY(MAX), '0x010203', 1)", "'e4279bc6-9e39-486a-9565-284d33b66b84'" }; // Act @@ -207,17 +203,16 @@ public void SelectQuoted_ShouldReturnCorrectResult() } [Theory] - [InlineData("Id", "int", true, "0", 15, true, "Latin1_General_CI_AS", "[Id] INT NULL = 0")] - [InlineData("Id", "int", false, "0", 15, true, "Latin1_General_CI_AS", "[Id] INT NOT NULL = 0")] - [InlineData("Id", "int", null, "0", 15, true, "Latin1_General_CI_AS", "[Id] INT = 0")] - // "[Id] int = 0" - [InlineData("Id", "int", true, "0", 15, false, "", "[Id] INT NULL = 0")] - [InlineData("Id", "varchar(Max)", true, "", 15, true, "Latin1_General_CI_AS", "[Id] VARCHAR(MAX) COLLATE Latin1_General_CI_AS NULL = ''")] - [InlineData("Id", "varchar(100)", true, "", 15, true, "Latin1_General_CI_AS", "[Id] VARCHAR(100) COLLATE Latin1_General_CI_AS NULL = ''")] - [InlineData("Id", "nvarchar(100)", true, "", 15, true, "Latin1_General_CI_AS", "[Id] NVARCHAR(100) COLLATE Latin1_General_CI_AS NULL = ''")] - [InlineData("Id", "nvarchar(100)", false, "", 15, false, "Latin1_General_CI_AS", "[Id] NVARCHAR(100) COLLATE Latin1_General_CI_AS NOT NULL = ''")] - [InlineData("Id", "nvarchar(100)", false, "", 15, false, "", "[Id] NVARCHAR(100) COLLATE DATABASE_DEFAULT NOT NULL = ''")] - public void ColumnDefinition_ReturnsCorrectResult(string columnName, string type, bool? isNullable, string defaultExpression, int columnNamePadding, bool doPadding, string collation, string expected) + [InlineData("Id", "int", true, "0", 15, true, "Latin1_General_CI_AS", "[Id] INT NULL = 0")] + [InlineData("Id", "int", false, "0", 15, true, "Latin1_General_CI_AS", "[Id] INT NOT NULL = 0")] + [InlineData("Id", "int", null, "0", 15, true, "Latin1_General_CI_AS", "[Id] INT = 0")] + [InlineData("Id", "int", true, "0", 15, false, "", "[Id] INT NULL = 0")] + [InlineData("Id", "varchar(Max)", true, "", 15, true, "Latin1_General_CI_AS", "[Id] VARCHAR(MAX) COLLATE Latin1_General_CI_AS NULL = ''")] + [InlineData("Id", "varchar(100)", true, "", 15, true, "Latin1_General_CI_AS", "[Id] VARCHAR(100) COLLATE Latin1_General_CI_AS NULL = ''")] + [InlineData("Id", "nvarchar(100)", true, "", 15, true, "Latin1_General_CI_AS", "[Id] NVARCHAR(100) COLLATE Latin1_General_CI_AS NULL = ''")] + [InlineData("Id", "nvarchar(100)", false, "", 15, false, "Latin1_General_CI_AS", "[Id] NVARCHAR(100) COLLATE Latin1_General_CI_AS NOT NULL = ''")] + [InlineData("Id", "nvarchar(100)", false, "", 15, false, "", "[Id] NVARCHAR(100) COLLATE DATABASE_DEFAULT NOT NULL = ''")] + public void ColumnDefinition_ReturnsCorrectResult(string columnName, string type, bool? isNullable, string defaultExpression, int columnNamePadding, bool doPadding, string? collation, string expected) { // Act string result = new ColumnDefinitionBuilder(columnName, type) diff --git a/tests/ProxyR.Api.Tests.Integration/UnitTest1.cs b/tests/ProxyR.Api.Tests.Integration/UnitTest1.cs deleted file mode 100644 index e92d9d2..0000000 --- a/tests/ProxyR.Api.Tests.Integration/UnitTest1.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ProxyR.Api.Tests.Integration -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - - } - } -} \ No newline at end of file diff --git a/tests/WebAPI/appsettings.json b/tests/WebAPI/appsettings.json index f475546..1f46768 100644 --- a/tests/WebAPI/appsettings.json +++ b/tests/WebAPI/appsettings.json @@ -11,7 +11,6 @@ "ConnectionStrings": { "localDb": "server=(local); database=TestDb2; trusted_connection=true;", - //"ProxyR": "server=(local); database=AdventureWorks2019; trusted_connection=true;" "ProxyR": "server=(local); database=TestDb2; trusted_connection=true;" }, @@ -28,11 +27,10 @@ "Prefix": "Api_", "Suffix": "", "Seperator": "_", - //"DefaultSchema": "Sales", "DefaultSchema": "ProxyR", "IncludeSchemaInPath": false, "ExcludedParameters": [], "RequiredParameterNames": [], - "ParameterModifiers": [] + "ParameterModifiers": [] } } \ No newline at end of file