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

Commit acc118c

Browse files
committed
Update ModelWithFieldsOfDifferentTypes
1 parent b6591a3 commit acc118c

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

tests/ServiceStack.OrmLite.Tests/OrmLiteDeleteTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public void Can_delete_ModelWithFieldsOfDifferentTypes_table_with_filter()
108108

109109
db.Insert(row);
110110

111-
db.Delete<ModelWithFieldsOfDifferentTypes>(x => x.LongId <= row.LongId);
111+
db.Delete<ModelWithFieldsOfDifferentTypes>(x => x.Long <= row.Long);
112112

113113
var dbRow = db.SingleById<ModelWithFieldsOfDifferentTypes>(row.Id);
114114

tests/ServiceStack.OrmLite.Tests/OrmLiteUpdateTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void Can_update_ModelWithFieldsOfDifferentTypes_table_with_filter()
7171

7272
row.Name = "UpdatedName";
7373

74-
db.Update(row, x => x.LongId <= row.LongId);
74+
db.Update(row, x => x.Long <= row.Long);
7575

7676
var dbRow = db.SingleById<ModelWithFieldsOfDifferentTypes>(row.Id);
7777

@@ -91,7 +91,7 @@ public void Can_update_with_anonymousType_and_expr_filter()
9191
row.Name = "UpdatedName";
9292

9393
db.Update<ModelWithFieldsOfDifferentTypes>(new { row.Name, row.DateTime },
94-
x => x.LongId >= row.LongId && x.LongId <= row.LongId);
94+
x => x.Long >= row.Long && x.Long <= row.Long);
9595

9696
var dbRow = db.SingleById<ModelWithFieldsOfDifferentTypes>(row.Id);
9797
Console.WriteLine(dbRow.Dump());

tests/ServiceStack.OrmLite.Tests/Shared/ModelWithFieldsOfDifferentTypes.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWi
6161
Assert.That(actual.Id, Is.EqualTo(expected.Id.Value));
6262
Assert.That(actual.Name, Is.EqualTo(expected.Name));
6363
Assert.That(actual.Guid, Is.EqualTo(expected.Guid.Value));
64-
Assert.That(actual.LongId, Is.EqualTo(expected.LongId.Value));
64+
Assert.That(actual.Long, Is.EqualTo(expected.LongId.Value));
6565
Assert.That(actual.Bool, Is.EqualTo(expected.Bool.Value));
6666
try
6767
{
@@ -94,7 +94,9 @@ public class ModelWithFieldsOfDifferentTypes
9494

9595
public string Name { get; set; }
9696

97-
public long LongId { get; set; }
97+
public int Int { get; set; }
98+
99+
public long Long { get; set; }
98100

99101
public Guid Guid { get; set; }
100102

@@ -106,6 +108,8 @@ public class ModelWithFieldsOfDifferentTypes
106108

107109
public double Double { get; set; }
108110

111+
public decimal Decimal { get; set; }
112+
109113
public static ModelWithFieldsOfDifferentTypes Create(int id)
110114
{
111115
var row = new ModelWithFieldsOfDifferentTypes
@@ -114,8 +118,10 @@ public static ModelWithFieldsOfDifferentTypes Create(int id)
114118
Bool = id % 2 == 0,
115119
DateTime = DateTime.Now.AddDays(id),
116120
Double = 1.11d + id,
121+
Decimal = 2.22m + id,
117122
Guid = Guid.NewGuid(),
118-
LongId = 999 + id,
123+
Int = 10 + id,
124+
Long = 999 + id,
119125
Name = "Name" + id
120126
};
121127

@@ -130,8 +136,10 @@ public static ModelWithFieldsOfDifferentTypes CreateConstant(int id)
130136
Bool = id % 2 == 0,
131137
DateTime = new DateTime(1979, (id % 12) + 1, (id % 28) + 1),
132138
Double = 1.11d + id,
139+
Decimal = 2.22m + id,
133140
Guid = new Guid(((id % 240) + 16).ToString("X") + "726E3B-9983-40B4-A8CB-2F8ADA8C8760"),
134-
LongId = 999 + id,
141+
Int = 10 + id,
142+
Long = 999 + id,
135143
Name = "Name" + id
136144
};
137145

@@ -164,7 +172,7 @@ public static void AssertIsEqual(ModelWithFieldsOfDifferentTypes actual, ModelWi
164172
Assert.That(actual.Id, Is.EqualTo(expected.Id));
165173
Assert.That(actual.Name, Is.EqualTo(expected.Name));
166174
Assert.That(actual.Guid, Is.EqualTo(expected.Guid));
167-
Assert.That(actual.LongId, Is.EqualTo(expected.LongId));
175+
Assert.That(actual.Long, Is.EqualTo(expected.Long));
168176
Assert.That(actual.Bool, Is.EqualTo(expected.Bool));
169177
try
170178
{

0 commit comments

Comments
 (0)