Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 972767a

Browse files
committed
Add test for Issue #449 UpdateOnly bug
1 parent 30af989 commit 972767a

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using NUnit.Framework;
2+
using ServiceStack.Model;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace ServiceStack.OrmLite.Tests.Issues
10+
{
11+
abstract class ProductBase : IHasIntId
12+
{
13+
public int Id { get; set; }
14+
15+
public string ManufacturingMessage { get; set; }
16+
}
17+
18+
class ProductSheet : ProductBase
19+
{
20+
21+
}
22+
23+
public class CanBuildExpressionWithAbstractType : OrmLiteTestBase
24+
{
25+
[Test]
26+
public void Can_Update_Property_In_Abstract_Base_Class()
27+
{
28+
using (var db = OpenDbConnection())
29+
{
30+
db.DropAndCreateTable<ProductSheet>();
31+
db.Insert(new ProductSheet { Id = 23, ManufacturingMessage = "test" });
32+
db.UpdateOnly(new ProductSheet { ManufacturingMessage = "toto" }, p => p.ManufacturingMessage, p => p.Id == 23);
33+
var sheet = db.Select<ProductSheet>().FirstOrDefault(p => p.Id == 23);
34+
Assert.AreEqual("toto", sheet.ManufacturingMessage);
35+
}
36+
}
37+
38+
}
39+
}

tests/ServiceStack.OrmLite.Tests/ServiceStack.OrmLite.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
<Compile Include="DateTimeTests.cs" />
130130
<Compile Include="DefaultValueTests.cs" />
131131
<Compile Include="Issues\BelongsToIssue.cs" />
132+
<Compile Include="Issues\CanBuildExpressionWithAbstractType.cs" />
132133
<Compile Include="Issues\JoinBoolSqlServerIssue.cs" />
133134
<Compile Include="Issues\MergingNestedSqlExpressionIssue.cs" />
134135
<Compile Include="Issues\SqlExpressionSubSqlExpressionIssue.cs" />

0 commit comments

Comments
 (0)