diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/.gitignore b/TestApplications/NTDLS.Katzebase.UnitTests/.gitignore deleted file mode 100644 index 3dea4cee..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -bin/* -obj/* \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/@README.md b/TestApplications/NTDLS.Katzebase.UnitTests/@README.md deleted file mode 100644 index 316833b6..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/@README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Katzebase Tests - -## Supported Test Cases Execution Methods - -- Build and run with entry point defined in Program.fsx - ![image](https://github.com/user-attachments/assets/f2ca917d-cb82-435b-8666-4e5d4c7729f7) - -- Manually select a range and execute code snippets in fsi - ![image](https://github.com/user-attachments/assets/45aef106-9ee0-47ab-9255-9425510c5d01) - -- RunAll or right click on specific test case with Visual Studio Test Explorer - ![image](https://github.com/user-attachments/assets/a8dcd215-54d6-42ef-aed6-3e19a6fcb81c) diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/AssemblyInfo.fs b/TestApplications/NTDLS.Katzebase.UnitTests/AssemblyInfo.fs deleted file mode 100644 index 840b3d1d..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/AssemblyInfo.fs +++ /dev/null @@ -1,20 +0,0 @@ -namespace System - -open System.Reflection - - -[] -[] -[] -do () - -module internal AssemblyVersionInformation = - [] - let AssemblyTitle = "NTDLS.Katzebase.UnitTests" - - [] - let AssemblyProduct = "NTDLS.Katzebase" - - [] - let AssemblyDescription = "Unit test cases for Katzebase" - diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/AssemblyInfo.fs.bak b/TestApplications/NTDLS.Katzebase.UnitTests/AssemblyInfo.fs.bak deleted file mode 100644 index 94aaf51f..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/AssemblyInfo.fs.bak +++ /dev/null @@ -1,19 +0,0 @@ -namespace System - -open System.Reflection - - -[] -[] -[] -do () - -module internal AssemblyVersionInformation = - [] - let AssemblyTitle = "Akkling.Tests" - - [] - let AssemblyProduct = "Akkling" - - [] - let AssemblyDescription = "F# wrapper library for Akka.NET" diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Build.ps1 b/TestApplications/NTDLS.Katzebase.UnitTests/Build.ps1 deleted file mode 100644 index 5ee5084d..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Build.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -param( - $buildConfig = "release" -) -write-host ("[Build] Current path: " + (pwd).path) - - -dotnet build --no-dependencies -c $buildConfig - -write-host (get-date) \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Configs/appsettings.json b/TestApplications/NTDLS.Katzebase.UnitTests/Configs/appsettings.json deleted file mode 100644 index 6c03fcc8..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Configs/appsettings.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "ListenPort": 6858, - "DataRootPath": ".\\Root", - "TransactionDataPath": ".\\Transaction", - "LogDirectory": ".\\Logs", - "FlushLog": true, - "DefaultDocumentPageSize": 100, - "UseCompression": true, - "HealthMonitoringEnabled": true, - "HealthMonitoringCheckpointSeconds": 600, - "HealthMonitoringInstanceLevelEnabled": false, - "HealthMonitoringInstanceLevelTimeToLiveSeconds": 600, - "MaxIdleConnectionSeconds": 600, - "DefaultIndexPartitions": 100, - "LockWaitTimeoutSeconds": 0, - "DeferredIOEnabled": true, - "WriteTraceData": false, - "CacheEnabled": true, - "CacheMaxMemoryMegabytes": 4096, - "CacheScavengeInterval": 10, - "CachePartitions": 32, - "CacheSeconds": 3600, - "IndexingThreadPoolSize": 0, - "IndexingThreadPoolQueueDepth": 10000, - "IndexingOperationThreadPoolQueueDepth": 100, - "LookupThreadPoolSize": 0, - "LookupThreadPoolQueueDepth": 10000, - "LookupOperationThreadPoolQueueDepth": 100 -} diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/NTDLS.Katzebase.UnitTests.fsproj b/TestApplications/NTDLS.Katzebase.UnitTests/NTDLS.Katzebase.UnitTests.fsproj deleted file mode 100644 index 8c6d6d5e..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/NTDLS.Katzebase.UnitTests.fsproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - Exe - net8.0 - .\bin - - - $(DefineConstants);COMPARE;NON_GENERIC_TDATA - - - $(DefineConstants);COMPARE;NON_GENERIC_TDATA - - - - - - - PreserveNewest - - - Shared/UnitTestsSharedResource.fsx - - - - Shared/Tests.fsx - - - - Unit/Engine/IO/BasicTest.IO.fsx - - - - Unit/Engine/Parser/BasicTest.Parser.fsx - - - - Unit/Engine/Execution/DDL/BasicTest.DDLExecution.fsx - - - - Unit/Engine/Execution/DML/BasicTest.DMLExecution.fsx - - - - Program.fsx - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/NTDLS.Katzebase.UnitTests.fsproj.bak b/TestApplications/NTDLS.Katzebase.UnitTests/NTDLS.Katzebase.UnitTests.fsproj.bak deleted file mode 100644 index 1e6de3f9..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/NTDLS.Katzebase.UnitTests.fsproj.bak +++ /dev/null @@ -1,80 +0,0 @@ - - - - Exe - net8.0 - .\bin - - - $(DefineConstants);COMPARE;GENERIC_TDATA - - - $(DefineConstants);COMPARE;GENERIC_TDATA - - - - - - - PreserveNewest - - - Shared/UnitTestsSharedResource.fsx - - - - Shared/Tests.fsx - - - - Unit/Engine/IO/BasicTest.IO.fsx - - - - Unit/Engine/Parser/BasicTest.Parser.fsx - - - - Unit/Engine/Execution/DDL/BasicTest.DDLExecution.fsx - - - - Unit/Engine/Execution/DML/BasicTest.DMLExecution.fsx - - - - Program.fsx - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.1.fsx deleted file mode 100644 index 5d101127..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.1.fsx +++ /dev/null @@ -1,15 +0,0 @@ -namespace NTDLS.Katzebase.UnitTests - -open Shared -open BasicTest.Parser.ver.``0``.``0``.``1`` -open BasicTest.IO.ver.``0``.``0``.``1``.IOTests -open BasicTest.DDLExecution.ver.``0``.``0``.``1`` -open BasicTest.DMLExecution.ver.``0``.``0``.``1`` - -module KatzebaseTests = - //if false then - ParserBasicTests.``Parse "SELECT * FROM MASTER:ACCOUNT"`` None - ParserBasicTests.``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ?Username AND PasswordHash = ?PasswordHash"`` None - DDLExecutionBasicTests.``Execute "CREATE SCHEMA testSch"`` None - DMLExecutionBasicTests.``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` None - printfn "Done!" \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.1.fsx.bak b/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.1.fsx.bak deleted file mode 100644 index 2e0d81ca..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.1.fsx.bak +++ /dev/null @@ -1,10 +0,0 @@ -namespace NTDLS.Katzebase.UnitTests - -open Shared -open BasicTest.Parser.ver.``0``.``0``.``1`` -open BasicTest.IO.ver.``0``.``0``.``1``.IOTests - -module KatzebaseTests = - ParserBasicTests.``Parse "SELECT * FROM MASTER:ACCOUNT"`` None - ParserBasicTests.``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ?Username AND PasswordHash = ?PasswordHash"`` None - printfn "Done!" \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.2.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.2.fsx deleted file mode 100644 index d2823520..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Program.ver.0.0.2.fsx +++ /dev/null @@ -1,15 +0,0 @@ -namespace NTDLS.Katzebase.UnitTests - -open Shared -open BasicTest.Parser.ver.``0``.``0``.``1`` -open BasicTest.IO.ver.``0``.``0``.``1``.IOTests -open BasicTest.DDLExecution.ver.``0``.``0``.``2`` -open BasicTest.DMLExecution.ver.``0``.``0``.``2`` - -module KatzebaseTests = - if false then - ParserBasicTests.``Parse "SELECT * FROM MASTER:ACCOUNT"`` None - ParserBasicTests.``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ?Username AND PasswordHash = ?PasswordHash"`` None - DDLExecutionBasicTests.``Execute "CREATE SCHEMA testSch"`` None - DMLExecutionBasicTests.``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` None - printfn "Done!" \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DDLExecution/BasicTest.DDLExecution.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DDLExecution/BasicTest.DDLExecution.ver.0.0.1.fsx deleted file mode 100644 index 248a9d89..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DDLExecution/BasicTest.DDLExecution.ver.0.0.1.fsx +++ /dev/null @@ -1,86 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" -#load "../../Tests.ver.0.0.1.fsx" -#r "nuget: DecimalMath.DecimalEx, 1.0.2" -#r "nuget: Xunit" -#r "nuget: NCalc" -#endif - -open Shared -open Tests -open Xunit -open Xunit.Abstractions -open System -open System.Collections.Generic - -module DDLExecutionBasicTests = - //open NTDLS.Katzebase.Parsers. - - open NTDLS.Katzebase.Client.Payloads - open NTDLS.Katzebase.Client.Types - open NTDLS.Katzebase.Parsers - - type SingleCount () = - let mutable c = 0 - member this.Count - with get() = c - and set(v) = c <- v - - let ``Execute "CREATE SCHEMA testSch"`` (outputOpt:ITestOutputHelper option) = - let testSchema = "testSchDDL" - let preLogin = _core.Sessions.CreateSession(Guid.NewGuid(), "testUser", "testClient") - try - _core.Query.SystemExecuteNonQuery(preLogin, $"DROP SCHEMA {testSchema}") - with - | exn -> - () - _core.Query.SystemExecuteNonQuery(preLogin, $"CREATE SCHEMA {testSchema}") - _core.Query.SystemExecuteNonQuery(preLogin, $"insert into {testSchema} (\r\nid = 123, value = '456'\r\n)") - _core.Query.SystemExecuteNonQuery(preLogin, $"insert into {testSchema} (\r\nid = 321, value = '654'\r\n)") - _core.Transactions.Commit(preLogin) - //let cnt = _core.Query.ExecuteQuery(preLogin, "SELECT COUNT(*) FROM testSch", Unchecked.defaultof>) - //equals 1 (cnt |> Seq.item 0).Count - let userParameters = new KbInsensitiveDictionary() - - - let countTest sql expectedCount = - try - let preparedQueries = StaticQueryParser.ParseBatch(sql, _core.GlobalConstants, userParameters) - let preparedQuery = preparedQueries.Item 0 - - let queryResultCollection = _core.Query.ExecuteQuery(preLogin, preparedQuery) - equals 1 queryResultCollection.Collection.Count - - let queryDocList = ((queryResultCollection.Collection.Item 0) :?> KbQueryDocumentListResult).Rows - equals 1 queryDocList.Count - equals $"{expectedCount}" queryDocList[0].Values[0] - - let sc = - _core.Query.ExecuteQuery(preLogin, sql, Unchecked.defaultof>) - |> Seq.toArray - |> Array.item 0 - - equals expectedCount sc.Count - with - | exn -> - testPrint outputOpt "[By design] %s" exn.InnerException.InnerException.Message - equals "Value should not be null. (Parameter 'textValue')" exn.InnerException.InnerException.Message - - testPrint outputOpt "count scalar" - countTest $"SELECT COUNT(1) as Count FROM {testSchema}" 2 - - testPrint outputOpt "count star" - countTest $"SELECT COUNT(*) as Count FROM {testSchema}" 2 - - testPrint outputOpt "count column id" - countTest $"SELECT COUNT(id) as Count FROM {testSchema}" 2 - - testPrint outputOpt "count column not existed" - countTest $"SELECT COUNT(not_existed_column) as Count FROM {testSchema}" 2 - - - type CommonTests (output:ITestOutputHelper) = - [] - member this.``Execute "CREATE SCHEMA testSch"`` () = - ``Execute "CREATE SCHEMA testSch"`` (Some output) - diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DDLExecution/BasicTest.DDLExecution.ver.0.0.2.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DDLExecution/BasicTest.DDLExecution.ver.0.0.2.fsx deleted file mode 100644 index 0b48d322..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DDLExecution/BasicTest.DDLExecution.ver.0.0.2.fsx +++ /dev/null @@ -1,83 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" -#load "../../Tests.ver.0.0.1.fsx" -#r "nuget: DecimalMath.DecimalEx, 1.0.2" -#r "nuget: Xunit" -#r "nuget: NCalc" -#endif - -#if GENERIC_TDATA - -#else -open NTDLS.Katzebase.Api.Payloads -#endif - -open Shared -open Tests -open Xunit -open Xunit.Abstractions -open System - -module DDLExecutionBasicTests = - open NTDLS.Katzebase.Parsers.Query - - //open NTDLS.Katzebase.Api.Payloads - open NTDLS.Katzebase.Api.Types - - type SingleCount () = - let mutable c = 0 - member this.Count - with get() = c - and set(v) = c <- v - - let ``Execute "CREATE SCHEMA testSch"`` (outputOpt:ITestOutputHelper option) = - _core.Query.SystemExecuteAndCommitNonQuery($"insert into {testSchemaDDL} (\r\nid: 123, value: '456'\r\n)") |> ignore - _core.Query.SystemExecuteAndCommitNonQuery($"insert into {testSchemaDDL} (\r\nid: 321, value: '654'\r\n)") |> ignore - _core.Transactions.Commit(preLogin) - //let cnt = _core.Query.SystemExecuteQuery(preLogin, "SELECT COUNT(*) FROM testSch", Unchecked.defaultof>) - //equals 1 (cnt |> Seq.item 0).Count - let userParameters = new KbInsensitiveDictionary() - - - let countTest sql expectedCount = - try - let queries = StaticParserBatch.Parse(sql, userParameters) - let query = queries.Item 0 - - let queryResultCollection = _core.Query.ExecuteQuery(preLogin, query) - equals 1 queryResultCollection.Collection.Count - - let queryDocList = (queryResultCollection.Collection.Item 0).Rows - equals 1 queryDocList.Count - equals $"{expectedCount}" queryDocList[0].Values[0].me - - let sc = - _core.Query.SystemExecuteQueryAndCommit(sql, Unchecked.defaultof>) - |> Seq.toArray - |> Array.item 0 - - equals expectedCount sc.Count - with - | exn -> - testPrint outputOpt "[By design] %s" exn.Message - equals "Value should not be null. (Parameter 'textValue')" exn.InnerException.InnerException.Message - - testPrint outputOpt "count scalar" - countTest $"SELECT COUNT(1) as Count FROM {testSchemaDDL}" 2 - - testPrint outputOpt "count star" - countTest $"SELECT COUNT(*) as Count FROM {testSchemaDDL}" 2 - - testPrint outputOpt "count column id" - countTest $"SELECT COUNT(id) as Count FROM {testSchemaDDL}" 2 - - testPrint outputOpt "count column not existed" - countTest $"SELECT COUNT(not_existed_column) as Count FROM {testSchemaDDL}" 0 - - testPrint outputOpt "[PASSED] Execute \"CREATE SCHEMA testSch\"" - - type CommonTests (output:ITestOutputHelper) = - [] - member this.``Execute "CREATE SCHEMA testSch"`` () = - ``Execute "CREATE SCHEMA testSch"`` (Some output) - diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DMLExecution/BasicTest.DMLExecution.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DMLExecution/BasicTest.DMLExecution.ver.0.0.1.fsx deleted file mode 100644 index efd87290..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DMLExecution/BasicTest.DMLExecution.ver.0.0.1.fsx +++ /dev/null @@ -1,140 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" -#load "../../Tests.ver.0.0.1.fsx" -#r "nuget: DecimalMath.DecimalEx, 1.0.2" -#r "nuget: Xunit" -#r "nuget: NCalc" -#endif - -open Shared -open Tests -open Xunit -open Xunit.Abstractions -open System -open System.Collections.Generic - -module DMLExecutionBasicTests = - open NTDLS.Katzebase.Parsers - open NTDLS.Katzebase.Parsers.Query - open NTDLS.Katzebase.Parsers.Query.Fields - open NTDLS.Katzebase.Client.Types - open NTDLS.Katzebase.Engine.QueryProcessing - - type ExprProc = StaticScalerExpressionProcessor - - type TwoColumnString () = - member val COL1 = "" with get, set - member val COL2 = "" with get, set - - type TwoColumnInt () = - member val COL1 = 0 with get, set - member val COL2 = 0 with get, set - - type TwoColumnDouble () = - member val COL1 = 0.0 with get, set - member val COL2 = 0.0 with get, set - let testSchema = $"testSchDML" - let plainInsert = $"""INSERT INTO {testSchema} (COL1, COL2) VALUES (1,2), ("A", "B")""" - - let ``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` (outputOpt:ITestOutputHelper option) = - let preLogin = _core.Sessions.CreateSession(Guid.NewGuid(), "testUser", "testClient") - try - _core.Query.SystemExecuteNonQuery(preLogin, $"DROP SCHEMA {testSchema}") - with - | exn -> - () - _core.Query.SystemExecuteNonQuery(preLogin, $"CREATE SCHEMA {testSchema}") - - let userParameters = new KbInsensitiveDictionary() - let preparedQueries = StaticQueryParser.ParseBatch(plainInsert, _core.GlobalConstants, userParameters) - let preparedQuery = preparedQueries.Item 0 - - equals [|"COL1"; "COL2"|] (preparedQuery.InsertFieldNames |> Seq.toArray) - equals 2 preparedQuery.InsertFieldValues.Count - - let insert0 = preparedQuery.InsertFieldValues.Item 0 - let insert1 = preparedQuery.InsertFieldValues.Item 1 - - equals 2 insert0.Count - equals 2 insert1.Count - - let i0v0 = insert0.Item 0 - let i0v1 = insert0.Item 1 - let i1v0 = insert1.Item 0 - let i1v1 = insert1.Item 1 - - match i0v0.Expression with - | :? Fields.QueryFieldConstantNumeric as num -> - equals "$n_2$" num.Value - - match i0v1.Expression with - | :? Fields.QueryFieldConstantNumeric as num -> - equals "$n_3$" num.Value - - match i1v0.Expression with - | :? Fields.QueryFieldConstantString as str -> - equals "$s_0$" str.Value - - match i1v1.Expression with - | :? Fields.QueryFieldConstantString as str -> - equals "$s_1$" str.Value - - let transactionReference = _core.Transactions.APIAcquire(preLogin) - let fieldQueryCollection = QueryFieldCollection (preparedQuery.Batch) - let auxiliaryFields = KbInsensitiveDictionary () - let collapsed01 = - ExprProc.CollapseScalerQueryField( - i0v1.Expression - , transactionReference.Transaction - , preparedQuery, fieldQueryCollection - , auxiliaryFields) - let collapsed11 = - ExprProc.CollapseScalerQueryField( - i1v1.Expression - , transactionReference.Transaction - , preparedQuery, fieldQueryCollection - , auxiliaryFields) - - equals "2" collapsed01 - equals "B" collapsed11 - - let queryResultCollection = _core.Query.ExecuteQuery(preLogin, preparedQuery) - _core.Transactions.Commit(preLogin) - - - let rString = - _core.Query.ExecuteQuery(preLogin, $"SELECT * FROM {testSchema} ORDER BY COL1", Unchecked.defaultof>) - |> Seq.toArray - - equals 2 rString.Length - equals "1" rString[0].COL1 - equals "B" rString[1].COL2 - - let rInt = - _core.Query.ExecuteQuery(preLogin, $"SELECT * FROM {testSchema} where COL1 = 1", Unchecked.defaultof>) - |> Seq.toArray - - equals 1 rInt.Length - equals 1 rInt[0].COL1 - - let rDouble = - _core.Query.ExecuteQuery(preLogin, $"SELECT * FROM {testSchema} where COL1 = 1", Unchecked.defaultof>) - |> Seq.toArray - - equals 1 rDouble.Length - equals 1.0 rDouble[0].COL1 - - try - let rDouble = - _core.Query.ExecuteQuery(preLogin, $"SELECT * FROM {testSchema}", Unchecked.defaultof>) - |> Seq.toArray - - () - with - | exn -> - equals "The input string 'A' was not in a correct format." exn.Message - - type CommonTests (output:ITestOutputHelper) = - [] - member this.``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` () = - ``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` (Some output) diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DMLExecution/BasicTest.DMLExecution.ver.0.0.2.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DMLExecution/BasicTest.DMLExecution.ver.0.0.2.fsx deleted file mode 100644 index 2c05ad2b..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/DMLExecution/BasicTest.DMLExecution.ver.0.0.2.fsx +++ /dev/null @@ -1,145 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" -#load "../../Tests.ver.0.0.1.fsx" -#r "nuget: DecimalMath.DecimalEx, 1.0.2" -#r "nuget: Xunit" -#r "nuget: NCalc" -#endif - -open Shared -open Tests -open Xunit -open Xunit.Abstractions -open System -open System.Collections.Generic - -module DMLExecutionBasicTests = - open NTDLS.Katzebase.Api.Types - open NTDLS.Katzebase.Engine.QueryProcessing.Expressions - open NTDLS.Katzebase.Parsers.Query.Fields - open NTDLS.Katzebase.Parsers.Query - - type ExprProc = StaticScalarExpressionProcessor - - type TwoColumnString () = - member val COL1 = "" with get, set - member val COL2 = "" with get, set - - type TwoColumnInt () = - member val COL1 = 0 with get, set - member val COL2 = 0 with get, set - - type TwoColumnDouble () = - member val COL1 = 0.0 with get, set - member val COL2 = 0.0 with get, set - - let plainInsert = $"""INSERT INTO {testSchemaDML} (COL1, COL2) VALUES (1,2), ("A", "B")""" - - let ``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` (outputOpt:ITestOutputHelper option) = - let preLogin = _core.Sessions.CreateSession(Guid.NewGuid(), "admin", "") - let userParameters = new KbInsensitiveDictionary() - let queries = StaticParserBatch.Parse(plainInsert, userParameters) - let query = queries.Item 0 - - equals [|"COL1"; "COL2"|] (query.InsertFieldNames |> Seq.toArray) - equals 2 query.InsertFieldValues.Count - - let insert0 = query.InsertFieldValues.Item 0 - let insert1 = query.InsertFieldValues.Item 1 - - equals 2 insert0.Count - equals 2 insert1.Count - - let i0v0 = insert0.Item 0 - let i0v1 = insert0.Item 1 - let i1v0 = insert1.Item 0 - let i1v1 = insert1.Item 1 - - match i0v0.Expression with - | :? QueryFieldConstantNumeric as num -> - equals "$n_2$" (num.V()) - | _ -> - () // Do nothing for unhandled cases - - match i0v1.Expression with - | :? QueryFieldConstantNumeric as num -> - equals "$n_3$" (num.V()) - | _ -> - () // Do nothing for unhandled cases - - match i1v0.Expression with - | :? QueryFieldConstantString as str -> - equals "$s_0$" (str.V()) - | _ -> - () // Do nothing for unhandled cases - - match i1v1.Expression with - | :? QueryFieldConstantString as str -> - equals "$s_1$" (str.V()) - | _ -> - () // Do nothing for unhandled cases - - let transactionReference = _core.Transactions.APIAcquire(preLogin) - let fieldQueryCollection = QueryFieldCollection (query.Batch) - let auxiliaryFields = KbInsensitiveDictionary () - let collapsed01 = - ExprProc.CollapseScalarQueryField( - i0v1.Expression - , transactionReference.Transaction - , query, fieldQueryCollection - , auxiliaryFields) - let collapsed11 = - ExprProc.CollapseScalarQueryField( - i1v1.Expression - , transactionReference.Transaction - , query, fieldQueryCollection - , auxiliaryFields) - - equals "2" collapsed01.me - equals "B" collapsed11.me - - let queryResultCollection = _core.Query.ExecuteQuery(preLogin, query) - _core.Transactions.Commit(preLogin) - - - let rString = - _core.Query.SystemExecuteQueryAndCommit($"SELECT * FROM {testSchemaDML} ORDER BY COL1", Unchecked.defaultof>) - |> Seq.toArray - - equals 2 rString.Length - equals "1" rString[0].COL1 - equals "B" rString[1].COL2 - - let rInt = - _core.Query.SystemExecuteQueryAndCommit($"SELECT * FROM {testSchemaDML} where COL1 = 1", Unchecked.defaultof>) - |> Seq.toArray - - equals 1 rInt.Length - equals 1 rInt[0].COL1 - - let rDouble = - _core.Query.SystemExecuteQueryAndCommit($"SELECT * FROM {testSchemaDML} where COL1 = 1", Unchecked.defaultof>) - |> Seq.toArray - - equals 1 rDouble.Length - equals 1.0 rDouble[0].COL1 - - try - let rDouble = - _core.Query.SystemExecuteQueryAndCommit($"SELECT * FROM {testSchemaDML}", Unchecked.defaultof>) - |> Seq.toArray - - () - with - | exn -> -#if GENERIC_TDATA - equals "The input string 'A' was not in a correct format." exn.Message -#else - equals "Failed to convert field [COL1] value [A] to type [Double]." exn.Message -#endif - testPrint outputOpt $"[PASSED] {plainInsert}" - - type CommonTests (output:ITestOutputHelper) = - [] - member this.``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` () = - ``Execute "INSERT INTO testSch (COL1, COL2) VALUES (1,2), ("A", "B")"`` (Some output) diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/IO/BasicTest.IO.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/IO/BasicTest.IO.ver.0.0.1.fsx deleted file mode 100644 index 35cd3d47..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/IO/BasicTest.IO.ver.0.0.1.fsx +++ /dev/null @@ -1,11 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" - -#endif - -open Shared - - - -module IOTests = - () \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/Parser/BasicTest.Parser.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/Parser/BasicTest.Parser.ver.0.0.1.fsx deleted file mode 100644 index 0181f1f1..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/Parser/BasicTest.Parser.ver.0.0.1.fsx +++ /dev/null @@ -1,105 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" -#load "../../Tests.ver.0.0.1.fsx" -#r "nuget: DecimalMath.DecimalEx, 1.0.2" -#r "nuget: Xunit" -#endif - -open Shared -open Tests -open Xunit -open Xunit.Abstractions -open System.Collections.Generic - - -module ParserBasicTests = - open NTDLS.Katzebase.Api - open NTDLS.Katzebase.Api.Exceptions - open NTDLS.Katzebase.Api.Types - open NTDLS.Katzebase.Parsers - open NTDLS.Katzebase.Parsers.Query.Fields - open NTDLS.Katzebase.Parsers.Query - - let ``Parse "SELECT * FROM MASTER:ACCOUNT"`` (outputOpt:ITestOutputHelper option) = - let userParameters = null - let queries = StaticParserBatch.Parse("SELECT * FROM MASTER:ACCOUNT", _core.GlobalConstants, userParameters.ToUserParametersInsensitiveDictionary()) - - equals 1 queries.Count - - let pq0 = queries[0] - - equals "MASTER:ACCOUNT" (pq0.Schemas.Item 0).Name - equals Constants.QueryType.Select pq0.QueryType - equals 0 pq0.Conditions.Collection.Count - - testPrint outputOpt "[PASSED] SELECT * FROM MASTER:ACCOUNT" - - let ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` (outputOpt:ITestOutputHelper option) = - try - let userParameters = null - let _ = StaticParserBatch.Parse("SELECT * FROM MASTER:ACCOUNT WHERE Username = @Username AND PasswordHash = @PasswordHash", _core.GlobalConstants, userParameters.ToUserParametersInsensitiveDictionary()) - () - with - | :? KbParserException as pe -> - equals "Variable not defined: [@Username]." pe.Message - - //[TODO-Test] will add another test case to verify ToUserParametersInsensitiveDictionary - let userParameters = new KbInsensitiveDictionary() - userParameters.Add("@Username", new KbVariable("testUser", KbConstants.KbBasicDataType.String)) - userParameters.Add("@PasswordHash", new KbVariable("testPassword", KbConstants.KbBasicDataType.String)) - let queries = StaticParserBatch.Parse("SELECT * FROM MASTER:ACCOUNT WHERE Username = @Username AND PasswordHash = @PasswordHash", _core.GlobalConstants, userParameters) - - equals 1 queries.Count - - let pq0 = queries[0] - equals "MASTER:ACCOUNT" (pq0.Schemas.Item 0).Name - equals Constants.QueryType.Select pq0.QueryType - equals 1 pq0.Conditions.Collection.Count - equals 4 pq0.Conditions.FieldCollection.Count - - let cf0 = pq0.Conditions.FieldCollection.Item 0 - let cf1 = pq0.Conditions.FieldCollection.Item 1 - let cf2 = pq0.Conditions.FieldCollection.Item 2 - let cf3 = pq0.Conditions.FieldCollection.Item 3 - - match cf0.Expression with - | :? QueryFieldDocumentIdentifier as qfdi -> - equals "Username" qfdi.FieldName - | _ -> - testPrint outputOpt "Field 0 type incorrect." - equals "QueryFieldDocumentIdentifier" (cf0.Expression.GetType().Name) - - match cf1.Expression with - | :? QueryFieldConstantString as qfcs -> - equals "$s_0$" qfcs.Value - | _ -> - testPrint outputOpt "Field 1 type incorrect." - equals "QueryFieldConstantString" (cf1.Expression.GetType().Name) - - match cf2.Expression with - | :? QueryFieldDocumentIdentifier as qfdi -> - equals "PasswordHash" qfdi.FieldName - | _ -> - testPrint outputOpt "Field 2 type incorrect." - equals "QueryFieldDocumentIdentifier" (cf2.Expression.GetType().Name) - - match cf3.Expression with - | :? QueryFieldConstantString as qfcs -> - equals "$s_1$" qfcs.Value - | _ -> - testPrint outputOpt "Field 3 type incorrect." - equals "QueryFieldConstantString" (cf3.Expression.GetType().Name) - - testPrint outputOpt "[PASSED] SELECT * FROM MASTER:ACCOUNT WHERE Username = @Username AND PasswordHash = @PasswordHash" - - let ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ?Username AND PasswordHash = ?PasswordHash"`` = - ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` - - type CommonTests (output:ITestOutputHelper) = - [] - member this.``Parse "SELECT * FROM MASTER:ACCOUNT"`` () = - ``Parse "SELECT * FROM MASTER:ACCOUNT"`` (Some output) - - [] - member this.``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` () = - ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` (Some output) \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/Parser/BasicTest.Parser.ver.0.0.2.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/Parser/BasicTest.Parser.ver.0.0.2.fsx deleted file mode 100644 index bc3fc3f6..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Engine/Parser/BasicTest.Parser.ver.0.0.2.fsx +++ /dev/null @@ -1,105 +0,0 @@ -#if INTERACTIVE -#load "../../UnitTestsSharedResource.ver.0.0.1.fsx" -#load "../../Tests.ver.0.0.1.fsx" -#r "nuget: DecimalMath.DecimalEx, 1.0.2" -#r "nuget: Xunit" -#endif - -open Shared -open Tests -open Xunit -open Xunit.Abstractions -open System.Collections.Generic - - -module ParserBasicTests = - open NTDLS.Katzebase.Engine.Parsers - open NTDLS.Katzebase.Engine.Parsers.Query.Fields - open NTDLS.Katzebase.Client - open NTDLS.Katzebase.Client.Types - open NTDLS.Katzebase.Client.Exceptions - open NTDLS.Katzebase.Engine.Library - - let ``Parse "SELECT * FROM MASTER:ACCOUNT"`` (outputOpt:ITestOutputHelper option) = - let userParameters = null - let preparedQueries = StaticQueryParser.ParseBatch(_core, "SELECT * FROM MASTER:ACCOUNT", userParameters.ToUserParametersInsensitiveDictionary()) - - equals 1 preparedQueries.Count - - let pq0 = preparedQueries[0] - - equals "master:account" (pq0.Schemas.Item 0).Name - equals EngineConstants.QueryType.Select pq0.QueryType - equals 0 pq0.Conditions.Collection.Count - - testPrint outputOpt "[PASSED] SELECT * FROM MASTER:ACCOUNT" - - let ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` (outputOpt:ITestOutputHelper option) = - try - let userParameters = null - let _ = StaticQueryParser.ParseBatch(_core, "SELECT * FROM MASTER:ACCOUNT_WHERE Username = @Username AND PasswordHash = @PasswordHash", userParameters.ToUserParametersInsensitiveDictionary()) - () - with - | :? KbParserException as pe -> - equals "Variable [@Username] is not defined." pe.Message - - //[TODO-Test] will add another test case to verify ToUserParametersInsensitiveDictionary - let userParameters = new KbInsensitiveDictionary() - userParameters.Add("@Username", new KbConstant("testUser", KbConstants.KbBasicDataType.String)) - userParameters.Add("@PasswordHash", new KbConstant("testPassword", KbConstants.KbBasicDataType.String)) - let preparedQueries = StaticQueryParser.ParseBatch(_core, "SELECT * FROM MASTER:ACCOUNT WHERE Username = @Username AND PasswordHash = @PasswordHash", userParameters) - - equals 1 preparedQueries.Count - - let pq0 = preparedQueries[0] - equals "master:account" (pq0.Schemas.Item 0).Name - equals EngineConstants.QueryType.Select pq0.QueryType - equals 1 pq0.Conditions.Collection.Count - equals 4 pq0.Conditions.FieldCollection.Count - - let cf0 = pq0.Conditions.FieldCollection.Item 0 - let cf1 = pq0.Conditions.FieldCollection.Item 1 - let cf2 = pq0.Conditions.FieldCollection.Item 2 - let cf3 = pq0.Conditions.FieldCollection.Item 3 - - match cf0.Expression with - | :? QueryFieldDocumentIdentifier as qfdi -> - equals "Username" qfdi.FieldName - | _ -> - testPrint outputOpt "Field 0 type incorrect." - equals "QueryFieldDocumentIdentifier" (cf0.Expression.GetType().Name) - - match cf1.Expression with - | :? QueryFieldConstantString as str -> - equals "$s_0$" (str.V()) - | _ -> - testPrint outputOpt "Field 1 type incorrect." - equals "QueryFieldConstantString" (cf1.Expression.GetType().Name) - - match cf2.Expression with - | :? QueryFieldDocumentIdentifier as qfdi -> - equals "PasswordHash" qfdi.FieldName - | _ -> - testPrint outputOpt "Field 2 type incorrect." - equals "QueryFieldDocumentIdentifier" (cf2.Expression.GetType().Name) - - match cf3.Expression with - | :? QueryFieldConstantString as str -> - equals "$s_1$" (str.V()) - | _ -> - testPrint outputOpt "Field 3 type incorrect." - equals "QueryFieldConstantString" (cf3.Expression.GetType().Name) - - testPrint outputOpt "[PASSED] SELECT * FROM MASTER:ACCOUNT WHERE Username = @Username AND PasswordHash = @PasswordHash" - - let ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ?Username AND PasswordHash = ?PasswordHash"`` = - ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` - - type CommonTests (output:ITestOutputHelper) = - [] - member this.``Parse "SELECT * FROM MASTER:ACCOUNT"`` () = - ``Parse "SELECT * FROM MASTER:ACCOUNT"`` (Some output) - - [] - member this.``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` () = - ``[Condition] Parse "SELECT * FROM MASTER:ACCOUNT WHERE Username = ¢IUsername AND PasswordHash = ¢IPasswordHash"`` (Some output) \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Tests.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Tests.ver.0.0.1.fsx deleted file mode 100644 index 882d349c..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/Tests.ver.0.0.1.fsx +++ /dev/null @@ -1,25 +0,0 @@ -module Tests -#if INTERACTIVE -#r "nuget: Xunit" -#endif - - -open Xunit -open Xunit.Abstractions - -let equals (expected: 'a) (value: 'a) = Assert.Equal<'a>(expected, value) -let success = () - -let (|String|_|) (message: obj) = - match message with - | :? string as x -> Some x - | _ -> None - -let testPrint (outputOpt: ITestOutputHelper option) format = - Printf.kprintf (fun str -> - // write to console - printfn "%s" str - if outputOpt.IsSome then - // write to xUnit test output - outputOpt.Value.WriteLine(str) - ) format \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/UnitTestsSharedResource.ver.0.0.1.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/UnitTestsSharedResource.ver.0.0.1.fsx deleted file mode 100644 index 86d1ef88..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/UnitTestsSharedResource.ver.0.0.1.fsx +++ /dev/null @@ -1,45 +0,0 @@ -module Shared -#if INTERACTIVE -#r @"nuget: Newtonsoft.Json, 13.0.3" -#r @"nuget: NTDLS.DelegateThreadPooling, 1.4.8" -#r @"nuget: NTDLS.FastMemoryCache, 1.7.5" -#r @"nuget: NTDLS.Katzebase.Client, 1.7.8" -//#r @"nuget: NTDLS.Katzebase.Client.dev, 1.7.8.1" -//#r @"G:\coldfar_py\NTDLS.Katzebase.Client\bin\Debug\net8.0\NTDLS.Katzebase.Client.dll" -#r @"nuget: Serilog, 4.0.1" -#r @"nuget: NTDLS.Helpers, 1.2.9.0" -#r @"nuget: NTDLS.ReliableMessaging, 1.10.9.0" -#r @"../../../NTDLS.Katzebase.Shared/bin/Debug/net8.0/NTDLS.Katzebase.Shared.dll" -#r @"../../../NTDLS.Katzebase.Engine/bin/Debug/net8.0/NTDLS.Katzebase.Engine.dll" -#endif -open Newtonsoft.Json -open NTDLS.Katzebase.Shared -open NTDLS.Katzebase.Engine -open System.IO -open System.Reflection - -let json = - try - File.ReadAllText("appsettings.json"); - with - | _ -> - let fi = new FileInfo(Assembly.GetEntryAssembly().Location) - File.ReadAllText(fi.DirectoryName + @"\appsettings.json") - - -let settings = JsonConvert.DeserializeObject(json) - -let createIfDirNotExisted p = - let di = DirectoryInfo p - if not di.Exists then - di.Create() - -createIfDirNotExisted settings.DataRootPath -createIfDirNotExisted settings.TransactionDataPath -createIfDirNotExisted settings.LogDirectory - - -//prevent missing single schema for ver.0.0.1 -createIfDirNotExisted $"{settings.DataRootPath}/single" - -let _core = new EngineCore(settings) \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/UnitTestsSharedResource.ver.0.0.2.fsx b/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/UnitTestsSharedResource.ver.0.0.2.fsx deleted file mode 100644 index a1012cb8..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/Scripts/UnitTestsSharedResource.ver.0.0.2.fsx +++ /dev/null @@ -1,176 +0,0 @@ -module Shared -#if INTERACTIVE -#r @"nuget: Newtonsoft.Json, 13.0.3" -#r @"nuget: NTDLS.DelegateThreadPooling, 1.4.8" -#r @"nuget: NTDLS.FastMemoryCache, 1.7.5" -#r @"nuget: NTDLS.Katzebase.Api, 1.7.8" -//#r @"nuget: NTDLS.Katzebase.Api.dev, 1.7.8.1" -//#r @"G:\coldfar_py\NTDLS.Katzebase.Api\bin\Debug\net8.0\NTDLS.Katzebase.Api.dll" - -#r @"nuget: Serilog, 4.0.1" -#r @"nuget: NTDLS.Helpers, 1.2.9.0" -#r @"nuget: NTDLS.ReliableMessaging, 1.10.9.0" -#r @"nuget: protobuf-net" -#r @"../../../NTDLS.Katzebase.Shared/bin/Debug/net8.0/NTDLS.Katzebase.Shared.dll" -#r @"../../../NTDLS.Katzebase.Engine/bin/Debug/net8.0/NTDLS.Katzebase.Engine.dll" -#endif -open Newtonsoft.Json -open NTDLS.Katzebase.Shared -open NTDLS.Katzebase.Engine -open NTDLS.Katzebase.Parsers.Query.Fields -open System -open System.IO -open System.Reflection -open ProtoBuf - -let json = - try - File.ReadAllText("appsettings.json"); - with - | _ -> - let fi = new FileInfo(Assembly.GetEntryAssembly().Location) - File.ReadAllText(fi.DirectoryName + @"\appsettings.json") - - -let settings = JsonConvert.DeserializeObject(json) - -let createIfDirNotExisted p = - let di = DirectoryInfo p - if not di.Exists then - di.Create() - -createIfDirNotExisted settings.DataRootPath -createIfDirNotExisted settings.TransactionDataPath -createIfDirNotExisted settings.LogDirectory - - -//prevent missing single schema for ver.0.0.1 -createIfDirNotExisted $"{settings.DataRootPath}/single" - -#if GENERIC_TDATA -[] -type fstring (s) = - [] - member val Value: string = s with get, set - member this.me = this.Value - interface IStringable with - override this.GetKey () = this.Value - override this.IsNullOrEmpty () = this.Value = null || this.Value = "" - override this.ToLowerInvariant () = fstring(this.Value.ToLowerInvariant()) - override this.ToT<'T> () = - match typeof<'T> with - | t when t = typeof -> box this.Value :?> 'T - | t when t = typeof -> box (Double.Parse this.Value) :?> 'T - | t when t = typeof -> box (Int32.Parse this.Value) :?> 'T - | t when t = typeof -> box (Boolean.Parse this.Value) :?> 'T - | t -> - failwithf "type %s not supported" t.Name - override this.ToT (t:Type) = - match t with - | t when t = typeof -> box this.Value - | t when t = typeof -> box (Double.Parse this.Value) - | t when t = typeof -> box (Int32.Parse this.Value) - | t when t = typeof -> box (Boolean.Parse this.Value) - | t -> - failwithf "type %s not supported" t.Name - - override this.ToNullableT<'T> () = - match typeof<'T> with - | t when t = typeof -> box this.Value :?> 'T - | t when t = typeof -> box (Double.Parse this.Value) :?> 'T - | t when t = typeof -> box (Int32.Parse this.Value) :?> 'T - | t when t = typeof -> box (Boolean.Parse this.Value) :?> 'T - | t -> - failwithf "type %s not supported" t.Name - new () = - fstring (null) -#endif - -let inline getValue<'S, 'T when 'S : (member Value : 'T)> (v:'S) = - v.Value - -type String - with - member inline this.V<'S, 'U when 'S : (member Value : 'U)>() = - let o = box this - o :?> 'U - - member this.me = this - -#if GENERIC_TDATA - - -open NTDLS.Katzebase.Api.Payloads -type KbQueryDocumentListResult = KbQueryDocumentListResult - - -type QueryFieldConstantNumeric = QueryFieldConstantNumeric -type QueryFieldConstantString = QueryFieldConstantString -type QueryFieldDocumentIdentifier = QueryFieldDocumentIdentifier - -open NTDLS.Katzebase.Parsers -type StaticQueryParser = StaticQueryParser - -type QueryFieldConstantNumeric<'T - when 'T :> IStringable - > - with - member inline this.V<'S, 'U when 'S : (member Value : 'U)>() = - let o:obj = box this.Value - try - getValue (o :?> 'S) - with - | exn -> - o :?> 'U - -type QueryFieldConstantString<'T - when 'T :> IStringable - > - with - member inline this.V<'S, 'U when 'S : (member Value : 'U)>() = - let o = box this.Value - try - getValue (o :?> 'S) - with - | exn -> - o :?> 'U - -let _core = - new EngineCore( - settings - , Func(fun s -> fstring(s)) - , Func(fun s -> fstring(s)) - , Func (fun s1 s2 -> String.Compare(s1.Value, s2.Value)) - ) -let preLogin = _core.Sessions.CreateSession(Guid.NewGuid(), "admin", "") -open NTDLS.Katzebase.Engine.Sessions -let accounts = _core.Query.ExecuteQuery>(preLogin, $"SELECT Username, PasswordHash FROM Master:Account") -printfn "%A" (accounts |> Seq.toArray) - -#else -let _core = new EngineCore(settings) -let preLogin = _core.Sessions.CreateSession(Guid.NewGuid(), "testUser", "testClient") -open NTDLS.Katzebase.Parsers.Query.Fields - -type fstring = string -type QueryFieldConstantNumeric with - member this.V<'S, 'U>() = this.Value -type QueryFieldConstantString with - member this.V<'S, 'U>() = this.Value - - -#endif - - - - - - -let testSchemaDDL = "testSchDDL" -let testSchemaDML = "testSchDML" - -_core.Query.SystemExecuteAndCommitNonQuery($"DROP SCHEMA {testSchemaDDL}") -_core.Query.SystemExecuteAndCommitNonQuery($"CREATE SCHEMA {testSchemaDDL}") - -_core.Query.SystemExecuteAndCommitNonQuery($"DROP SCHEMA {testSchemaDML}") -_core.Query.SystemExecuteAndCommitNonQuery($"CREATE SCHEMA {testSchemaDML}") \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/app.config b/TestApplications/NTDLS.Katzebase.UnitTests/app.config deleted file mode 100644 index 8e71b4d7..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/app.config +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - - True - - - - \ No newline at end of file diff --git a/TestApplications/NTDLS.Katzebase.UnitTests/version mapping.txt b/TestApplications/NTDLS.Katzebase.UnitTests/version mapping.txt deleted file mode 100644 index 0b24cdc3..00000000 --- a/TestApplications/NTDLS.Katzebase.UnitTests/version mapping.txt +++ /dev/null @@ -1,4 +0,0 @@ -generic => non-generic -d9e171d50bcf6621740c0d8cc0e7d920ea28b809 => a6692e759877461bba6f8be9dbc09850d057cd80 -b9b1cde29a108c27e8dd7f58e950b443e168a4fe => 7386346924ced48fd4deecf977e9a676d469b44d -d060dc7708c367c24529f5985c61085ac0d6c1d9 => b3699d63a3337d936e302bcc8fa746376f02b317