Jo Shields fe777c5c82 Imported Upstream version 3.8.0
Former-commit-id: 6a76a29bd07d86e57c6c8da45c65ed5447d38a61
2014-09-04 09:07:35 +01:00

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;
}
}
}
}