Permalink
Browse files

Feature parity with SqlTests from main Simple.Data repo.

  • Loading branch information...
1 parent 33d1a64 commit af3726f8221c24e99da3607e085461ff65befb3a @richardhopton committed Jan 24, 2012
@@ -67,6 +67,8 @@ BEGIN
DROP TABLE dba.EnumTest
IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id=OBJECT_ID('dba.DeleteTest') AND type='U')
DROP TABLE dba.DeleteTest
+ IF EXISTS(SELECT * FROM dbo.sysobjects WHERE id=OBJECT_ID('dba.DecimalTest') AND type='U')
+ DROP TABLE dba.DecimalTest
CREATE TABLE dba.Users (
Id INT NOT NULL DEFAULT AUTOINCREMENT,
@@ -154,6 +156,11 @@ BEGIN
ALTER TABLE dba.DeleteTest
ADD CONSTRAINT PK_DeleteTest PRIMARY KEY CLUSTERED (Id)
+ CREATE TABLE dba.DecimalTest(
+ Id int NOT NULL DEFAULT AUTOINCREMENT,
+ Value decimal(20,6) NOT NULL
+ )
+
BEGIN TRANSACTION
INSERT INTO dba.Customers (CustomerId, Name, Address) VALUES (1, 'Test', '100 Road')
INSERT INTO dba.Orders (OrderId, OrderDate, CustomerId) VALUES (1, '20101010 00:00:00.000', 1)
@@ -171,6 +178,7 @@ BEGIN
SET @PagingId = @PagingId + 1
END
+ INSERT INTO dba.DecimalTest (Value) VALUES (1.234567)
COMMIT TRANSACTION
ALTER TABLE dba.Orders
@@ -0,0 +1,28 @@
+using System;
+using NUnit.Framework;
+
+namespace Simple.Data.SqlAnywhereTest.SchemaTests
+{
+ [TestFixture]
+ public class DataTypeTests
+ {
+ [Test]
+ public void TestDecimalCanBeRetrievedCorrectly()
+ {
+ var db = DatabaseHelper.Open();
+ var value = db.DecimalTest.FindById(1).Value;
+ Assert.AreEqual(typeof(Decimal), value.GetType());
+ Assert.AreEqual(1.234567, value);
+ }
+
+ [Test]
+ public void TestDecimalCanBeInsertedCorrectly()
+ {
+ var db = DatabaseHelper.Open();
+ var decimalTest = new { Value = 12.345678 };
+ var value = db.DecimalTest.Insert(decimalTest).Value;
+ Assert.AreEqual(typeof(Decimal), value.GetType());
+ Assert.AreEqual(decimalTest.Value, value);
+ }
+ }
+}
@@ -96,6 +96,7 @@
<Compile Include="FindTests.cs" />
<Compile Include="OrderDetailTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SchemaTests\DataTypeTests.cs" />
<Compile Include="SetupFixture.cs" />
<Compile Include="SqlQueryPagerTest.cs" />
<Compile Include="TestTraceListener.cs" />

0 comments on commit af3726f

Please sign in to comment.