fe777c5c82
Former-commit-id: 6a76a29bd07d86e57c6c8da45c65ed5447d38a61
70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
// SqliteFunctionTests.cs - NUnit Test Cases for SqliteFunction
|
|
//
|
|
// Authors:
|
|
// Rolf Bjarne Kvinge <rolf@xamarin.com>
|
|
//
|
|
|
|
//
|
|
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
|
|
//
|
|
|
|
using System;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Text;
|
|
using Mono.Data.Sqlite;
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoTests.Mono.Data.Sqlite
|
|
{
|
|
[TestFixture]
|
|
public class SqliteFunctionTest
|
|
{
|
|
readonly static string uri = Path.Combine (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "test.db");
|
|
|
|
[Test]
|
|
public void CollationTest()
|
|
{
|
|
var builder = new SqliteConnectionStringBuilder();
|
|
builder.DataSource = uri;
|
|
|
|
var connectionString = builder.ToString();
|
|
using (var connection = new SqliteConnection (connectionString)) {
|
|
connection.Open ();
|
|
connection.Close ();
|
|
}
|
|
}
|
|
|
|
[SqliteFunction(Name = "TestCollation", FuncType = FunctionType.Collation)]
|
|
public class TestCollation : SqliteFunction
|
|
{
|
|
public override int Compare (string param1, string param2)
|
|
{
|
|
return string.Compare (param1, param2);
|
|
}
|
|
}
|
|
|
|
[SqliteFunction(Name = "TestScalar", FuncType = FunctionType.Scalar)]
|
|
public class TestScalar : SqliteFunction
|
|
{
|
|
public override object Invoke (object[] args)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
[SqliteFunction(Name = "TestAggregate", FuncType = FunctionType.Aggregate)]
|
|
public class TestAggregate : SqliteFunction
|
|
{
|
|
public override void Step(object[] args, int stepNumber, ref object contextData)
|
|
{
|
|
}
|
|
|
|
public override object Final (object contextData)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|