66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using NUnit.Framework;
|
|
using LCU.Library.Internal.CoreApiWrapperLib.Utilities;
|
|
using System.Collections.Generic;
|
|
|
|
namespace LCU.Api.Internal.CoreApiWrapperTest.Utilities
|
|
{
|
|
public class QueryUtilitiesTest
|
|
{
|
|
public void GetQuery_Returns_QueryReturned()
|
|
{
|
|
var testEndpoint = "TEST_Query";
|
|
|
|
var result = QueryUtilities.GetQuery(testEndpoint);
|
|
|
|
var testCompare = "select TEST\r\nfrom TEST\r\nwhere TEST like TEST";
|
|
|
|
Assert.NotNull(result);
|
|
Assert.AreEqual(testCompare, result);
|
|
}
|
|
|
|
[Test]
|
|
public void GetQuery_Returns_EmptyReturned()
|
|
{
|
|
var testEndpoint = "TEST_Query_NOPE";
|
|
|
|
var result = QueryUtilities.GetQuery(testEndpoint);
|
|
|
|
Assert.IsEmpty(result);
|
|
}
|
|
|
|
[Test]
|
|
public void BuildParameterListString_Returns_StringOfParameterCommaDelimited()
|
|
{
|
|
var testValues = new List<string>()
|
|
{
|
|
"Test1",
|
|
"Test2",
|
|
"Test3"
|
|
};
|
|
|
|
var result = QueryUtilities.BuildParameterListString(testValues);
|
|
|
|
Assert.IsNotNull(result);
|
|
Assert.AreEqual(":param0,:param1,:param2" ,result);
|
|
}
|
|
|
|
[Test]
|
|
public void BuildDictionaryParameter_Returns_DictionaryWithThreeParams()
|
|
{
|
|
var testValues = new List<string>()
|
|
{
|
|
"Test1",
|
|
"Test2",
|
|
"Test3"
|
|
};
|
|
|
|
var result = QueryUtilities.BuildDictionaryParameter(testValues);
|
|
|
|
Assert.IsNotNull(result);
|
|
Assert.IsNotNull(result["param0"]);
|
|
Assert.IsNotNull(result["param1"]);
|
|
Assert.IsNotNull(result["param2"]);
|
|
}
|
|
}
|
|
}
|