1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| using System;
| using System.Collections.Generic;
| using System.Net.NetworkInformation;
| using Xunit;
| using System.Linq;
|
| public abstract class BaseReturnUUIdTests : PlDotNetTest
| {
| protected abstract string FunctionBody { get; }
|
| protected abstract LanguageType Language { get; }
|
| public BaseReturnUUIdTests()
| {
| FunctionInfo = new SqlFunctionInfo { Name = "ReturnUUId", Arguments = new List<FunctionArgument> { new FunctionArgument("a", "UUID") }, ReturnType = "UUID", Body = FunctionBody, Language = Language, IsStrict = false, };
| }
|
| public static object[][] TestCases()
| {
| return new object[][] { new object[] { "c#-uuid", "returnUUID1", "'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::UUID", "= 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::UUID" }, new object[] { "c#-uuid", "returnUUID2", "'123e4567-e89b-12d3-a456-426614174000'::UUID", "= '123e4567-e89b-12d3-a456-426614174000'::UUID" }, new object[] { "c#-uuid", "returnUUID3", "'87e3006a-604e-11ed-9b6a-0242ac120002'::UUID", "= '87e3006a-604e-11ed-9b6a-0242ac120002'::UUID" }, new object[] { "c#-uuid", "returnUUID4", "'024be913-3bf8-4499-9694-12769239b763'::UUID", "= '024be913-3bf8-4499-9694-12769239b763'::UUID" }, };
| }
|
| [Theory]
| [MemberData(nameof(TestCases))]
| public void TestReturnUUId(string featureName, string testName, string input, string expectedResult)
| {
| RunGenericTest(featureName, testName, input, expectedResult);
| }
| }
|
| [Trait("Language", "CSharp")]
| [Trait("Category", "UUId")]
| public class ReturnUUIdTestsCSharp : BaseReturnUUIdTests
| {
| protected override string FunctionBody => @"
| return a;
| ";
| protected override LanguageType Language => LanguageType.PlcSharp;
| }
|
|