markus / ConvertService / ServiceBase / UnitTest.Markus.Service / DataBaseTest.cs @ e6281033
이력 | 보기 | 이력해설 | 다운로드 (1.77 KB)
1 |
using System; |
---|---|
2 |
using Xunit; |
3 |
using Markus.Service.DataBase; |
4 |
using Xunit.Priority; |
5 |
using Markus.Service.Extensions; |
6 |
|
7 |
namespace UnitTest.Markus.Service |
8 |
{ |
9 |
public class DataBaseTest |
10 |
{ |
11 |
private readonly ConvertDatabase Database; |
12 |
|
13 |
private readonly string ConnectionString = @"data source=.\SQLEXPRESS;initial catalog=Markus;persist security info=True;user id=ConvertService;Password=ConvertService;MultipleActiveResultSets=True;"; |
14 |
private readonly string ProjectNo; |
15 |
private readonly string ConvertID; |
16 |
|
17 |
public DataBaseTest() |
18 |
{ |
19 |
Database = new ConvertDatabase(ConnectionString); |
20 |
|
21 |
ProjectNo = "000000"; |
22 |
ConvertID = new Guid().CreateUniqueGuid().ToString(); |
23 |
} |
24 |
|
25 |
[Fact,Priority(0)] |
26 |
public void AddConvertItem() |
27 |
{ |
28 |
bool result = Database.SetConvertDoc(ProjectNo, ConvertID, @"c:Test.pdf", "aaaaa"); |
29 |
Assert.True(result); |
30 |
} |
31 |
|
32 |
[Fact, Priority(1)] |
33 |
public void GetConvertItem() |
34 |
{ |
35 |
var result = Database.GetConvertItem(ProjectNo, ConvertID); |
36 |
Assert.NotNull(result); |
37 |
} |
38 |
|
39 |
[Fact, Priority(2)] |
40 |
public void ConvertItemChnageState() |
41 |
{ |
42 |
string testServiceID = new Guid().ToString(); |
43 |
|
44 |
var result = Database.SetConvertState(testServiceID,ConvertID,1,10,10,"test"); |
45 |
Assert.True(result); |
46 |
} |
47 |
|
48 |
[Fact, Priority(3)] |
49 |
public void ClearConvertItem() |
50 |
{ |
51 |
var result = Database.SetCleanUpItem(ConvertID,1); |
52 |
Assert.True(result == 1); |
53 |
} |
54 |
|
55 |
|
56 |
[Fact, Priority(4)] |
57 |
public void RemoveConvertItem() |
58 |
{ |
59 |
var result = Database.RemoveItem(ConvertID); |
60 |
Assert.True(result == 1); |
61 |
} |
62 |
} |
63 |
} |