Permalink
Browse files

Adds integration tests for PR #288 (Fixing byte based enums)

  • Loading branch information...
pleb committed May 26, 2016
1 parent 7724686 commit f885fb727bc457f1b809855ce40b71cf119ac7de
@@ -108,6 +108,9 @@
<Compile Include="..\PetaPoco.Tests.Integration\Models\OrderLine.cs">
<Link>Models\OrderLine.cs</Link>
</Compile>
<Compile Include="..\PetaPoco.Tests.Integration\Models\OrderLineStatus.cs">
<Link>Models\OrderLineStatus.cs</Link>
</Compile>
<Compile Include="..\PetaPoco.Tests.Integration\Models\OrderStatus.cs">
<Link>Models\OrderStatus.cs</Link>
</Compile>
@@ -28,6 +28,7 @@ CREATE TABLE [OrderLines] (
[Id] AUTOINCREMENT PRIMARY KEY,
[OrderId] INTEGER NOT NULL CONSTRAINT FK_OL_OrderId REFERENCES [Orders](Id),
[Qty] INTEGER NOT NULL,
[Status] INTEGER NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL
);
@@ -52,6 +53,7 @@ CREATE TABLE [SpecificOrderLines] (
[Id] AUTOINCREMENT PRIMARY KEY,
[OrderId] INTEGER NOT NULL CONSTRAINT FK_SO_OrderId REFERENCES [SpecificOrders](Id),
[Qty] INTEGER NOT NULL,
[Status] INTEGER NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL
);
@@ -37,6 +37,7 @@ public abstract class BaseDeleteTests : BaseDatabase
{
Quantity = 5,
SellPrice = 4.99m,
Status = OrderLineStatus.Pending
};
private Person _person = new Person
@@ -31,6 +31,7 @@ public abstract class BaseInsertTests : BaseDatabase
{
Quantity = 5,
SellPrice = 4.99m,
Status = OrderLineStatus.Pending
};
private readonly Person _person = new Person
@@ -25,6 +25,7 @@ public abstract class BaseQueryLinqTests : BaseDatabase
{
Quantity = 5,
SellPrice = 4.99m,
Status = OrderLineStatus.Pending
};
private readonly Person _person = new Person
@@ -28,6 +28,7 @@ public abstract class BaseUpdateTests : BaseDatabase
{
Quantity = 5,
SellPrice = 4.99m,
Status = OrderLineStatus.Pending
};
private Person _person = new Person
@@ -279,6 +280,7 @@ private static void UpdateProperties(OrderLine orderLine)
{
orderLine.Quantity = 6;
orderLine.SellPrice = 5.99m;
orderLine.Status = OrderLineStatus.Allocated;
}
}
}
@@ -2,7 +2,7 @@
// Apache License, Version 2.0 https://github.com/CollaboratingPlatypus/PetaPoco/blob/master/LICENSE.txt
// </copyright>
// <author>PetaPoco - CollaboratingPlatypus</author>
// <date>2015/12/07</date>
// <date>2016/05/27</date>
using System;
using System.Collections.Generic;
@@ -24,6 +24,9 @@ public class OrderLine
[Column]
public decimal SellPrice { get; set; }
[Column]
public OrderLineStatus Status { get; set; }
[ResultColumn]
public decimal Total
{
@@ -35,6 +38,7 @@ public void ShouldBe(OrderLine other)
Id.ShouldBe(other.Id);
OrderId.ShouldBe(other.OrderId);
Quantity.ShouldBe(other.Quantity);
Status.ShouldBe(other.Status);
SellPrice.ShouldBe(other.SellPrice);
}
@@ -51,6 +55,7 @@ public void ShouldNotBe(OrderLine other, bool sameIds)
OrderId.ShouldNotBe(other.OrderId);
}
Quantity.ShouldNotBe(other.Quantity);
Status.ShouldNotBe(other.Status);
SellPrice.ShouldNotBe(other.SellPrice);
}
}
@@ -0,0 +1,15 @@
// <copyright company="PetaPoco - CollaboratingPlatypus">
// Apache License, Version 2.0 https://github.com/CollaboratingPlatypus/PetaPoco/blob/master/LICENSE.txt
// </copyright>
// <author>PetaPoco - CollaboratingPlatypus</author>
// <date>2016/05/27</date>
namespace PetaPoco.Tests.Integration.Models
{
public enum OrderLineStatus : byte
{
Allocated,
Backorder,
Pending
}
}
@@ -2,7 +2,7 @@
// Apache License, Version 2.0 https://github.com/CollaboratingPlatypus/PetaPoco/blob/master/LICENSE.txt
// </copyright>
// <author>PetaPoco - CollaboratingPlatypus</author>
// <date>2015/12/07</date>
// <date>2016/05/27</date>
namespace PetaPoco.Tests.Integration.Models
{
@@ -180,6 +180,7 @@
<Compile Include="Models\NoteNullablePrimary.cs" />
<Compile Include="Models\Order.cs" />
<Compile Include="Models\OrderLine.cs" />
<Compile Include="Models\OrderLineStatus.cs" />
<Compile Include="Models\OrderStatus.cs" />
<Compile Include="Models\Person.cs" />
<Compile Include="Models\TransactionLog.cs" />
@@ -86,6 +86,7 @@ CREATE TABLE "OrderLines" (
"Id" INT PRIMARY KEY NOT NULL,
"OrderId" INT NOT NULL,
"Qty" SMALLINT NOT NULL,
"Status" SMALLINT NOT NULL,
"SellPrice" NUMERIC(10, 4) NOT NULL,
CONSTRAINT "FK_OrderLines_Orders" FOREIGN KEY ("OrderId") REFERENCES "Orders" ("Id")
);
@@ -148,6 +149,7 @@ CREATE TABLE "SpecificOrderLines" (
"Id" INT PRIMARY KEY NOT NULL,
"OrderId" INT NOT NULL,
"Qty" SMALLINT NOT NULL,
"Status" SMALLINT NOT NULL,
"SellPrice" NUMERIC(10, 4) NOT NULL,
CONSTRAINT "FK_SOLines_SOrders" FOREIGN KEY ("OrderId") REFERENCES "SpecificOrders"("Id")
);
@@ -36,6 +36,7 @@ CREATE TABLE dbo.[OrderLines] (
[Id] INT IDENTITY(1,1) PRIMARY KEY,
[OrderId] INT NOT NULL FOREIGN KEY REFERENCES dbo.[Orders](Id),
[Qty] SMALLINT NOT NULL,
[Status] TINYINT NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL
)
@@ -60,6 +61,7 @@ CREATE TABLE dbo.[SpecificOrderLines] (
[Id] INT IDENTITY(1,1) PRIMARY KEY,
[OrderId] INT NOT NULL FOREIGN KEY REFERENCES dbo.[SpecificOrders](Id),
[Qty] SMALLINT NOT NULL,
[Status] TINYINT NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL
)
@@ -28,6 +28,7 @@ CREATE TABLE [OrderLines] (
[Id] INT IDENTITY(1,1) PRIMARY KEY,
[OrderId] INT NOT NULL REFERENCES [Orders](Id),
[Qty] SMALLINT NOT NULL,
[Status] TINYINT NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL
);
@@ -52,6 +53,7 @@ CREATE TABLE [SpecificOrderLines] (
[Id] INT IDENTITY(1,1) PRIMARY KEY,
[OrderId] INT NOT NULL REFERENCES [SpecificOrders](Id),
[Qty] SMALLINT NOT NULL,
[Status] TINYINT NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL
);
@@ -29,6 +29,7 @@ CREATE TABLE `OrderLines` (
`Id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`OrderId` INT NOT NULL,
`Qty` SMALLINT NOT NULL,
`Status` SMALLINT NOT NULL,
`SellPrice` DECIMAL(10, 4) NOT NULL,
FOREIGN KEY `FK_OrderLines_Orders`(`OrderId`) REFERENCES `Orders`(`Id`)
) ENGINE=INNODB;
@@ -55,6 +56,7 @@ CREATE TABLE `SpecificOrderLines` (
`Id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`OrderId` INT NOT NULL,
`Qty` SMALLINT NOT NULL,
`Status` SMALLINT NOT NULL,
`SellPrice` DECIMAL(10, 4) NOT NULL,
FOREIGN KEY FK_SpecificOrderLines_SpecificOrders(OrderId) REFERENCES SpecificOrders(Id)
) ENGINE=INNODB;
@@ -29,6 +29,7 @@ CREATE TABLE `OrderLines` (
`Id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`OrderId` INT NOT NULL,
`Qty` SMALLINT NOT NULL,
`Status` SMALLINT NOT NULL,
`SellPrice` DECIMAL(10, 4) NOT NULL,
FOREIGN KEY `FK_OrderLines_Orders`(`OrderId`) REFERENCES `Orders`(`Id`)
) ENGINE=INNODB;
@@ -55,6 +56,7 @@ CREATE TABLE `SpecificOrderLines` (
`Id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
`OrderId` INT NOT NULL,
`Qty` SMALLINT NOT NULL,
`Status` SMALLINT NOT NULL,
`SellPrice` DECIMAL(10, 4) NOT NULL,
FOREIGN KEY FK_SpecificOrderLines_SpecificOrders(OrderId) REFERENCES SpecificOrders(Id)
) ENGINE=INNODB;
@@ -29,6 +29,7 @@ CREATE TABLE "OrderLines" (
"Id" SERIAL PRIMARY KEY NOT NULL,
"OrderId" INT NOT NULL,
"Qty" SMALLINT NOT NULL,
"Status" SMALLINT NOT NULL,
"SellPrice" NUMERIC(10, 4) NOT NULL,
CONSTRAINT "FK_OrderLines_Orders" FOREIGN KEY ("OrderId") REFERENCES "Orders"("Id")
);
@@ -55,6 +56,7 @@ CREATE TABLE "SpecificOrderLines" (
"Id" SERIAL PRIMARY KEY NOT NULL,
"OrderId" INT NOT NULL,
"Qty" SMALLINT NOT NULL,
"Status" SMALLINT NOT NULL,
"SellPrice" NUMERIC(10, 4) NOT NULL,
CONSTRAINT "FK_SpecificOrderLines_SpecificOrders" FOREIGN KEY ("OrderId") REFERENCES "SpecificOrders"("Id")
);
@@ -29,6 +29,7 @@ CREATE TABLE [OrderLines] (
[Id] INTEGER PRIMARY KEY NOT NULL,
[OrderId] INT NOT NULL,
[Qty] SMALLINT NOT NULL,
[Status] SMALLINT NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL,
CONSTRAINT [FK_OrderLines_Orders] FOREIGN KEY ([OrderId]) REFERENCES [Orders]([Id])
);
@@ -55,6 +56,7 @@ CREATE TABLE [SpecificOrderLines] (
[Id] INTEGER PRIMARY KEY NOT NULL,
[OrderId] INT NOT NULL,
[Qty] SMALLINT NOT NULL,
[Status] SMALLINT NOT NULL,
[SellPrice] NUMERIC(10, 4) NOT NULL,
CONSTRAINT [FK_SpecificOrderLines_SpecificOrders] FOREIGN KEY ([OrderId]) REFERENCES [SpecificOrders]([Id])
);

0 comments on commit f885fb7

Please sign in to comment.