forked from BAndysc/WoWDatabaseEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdateTests.cs
36 lines (31 loc) · 1.12 KB
/
UpdateTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using NUnit.Framework;
namespace WDE.SqlQueryGenerator.Test
{
public class UpdateTests
{
[Test]
public void SimpleSet()
{
var query = Queries.Table("a").Where(r => true).Set("b", 2).Update();
Assert.AreEqual("UPDATE `a` SET `b` = 2;", query.QueryString);
}
[Test]
public void DualSet()
{
var query = Queries.Table("a").Where(r => true).Set("b", 2).Set("c", 3.5).Update();
Assert.AreEqual("UPDATE `a` SET `b` = 2, `c` = 3.5;", query.QueryString);
}
[Test]
public void TripleSet()
{
var query = Queries.Table("a").Where(r => true).Set("b", 2).Set("c", 3.5).Set("d", "abc").Update();
Assert.AreEqual("UPDATE `a` SET `b` = 2, `c` = 3.5, `d` = 'abc';", query.QueryString);
}
[Test]
public void SimpleSetWithWhere()
{
var query = Queries.Table("a").Where(r => r.Column<int>("b") == 3).Set("b", 2).Update();
Assert.AreEqual("UPDATE `a` SET `b` = 2 WHERE `b` = 3;", query.QueryString);
}
}
}