markus / ConvertService / ServiceBase / Markus.Service.DataBase.Test / DataBaseConvertDoc.cs @ c7555c83
이력 | 보기 | 이력해설 | 다운로드 (6.94 KB)
1 | 731c84b8 | taeseongkim | |
---|---|---|---|
2 | using NUnit.Framework; |
||
3 | bede677a | GeunHo Song | using NUnit.Framework.Interfaces; |
4 | 731c84b8 | taeseongkim | using System; |
5 | using System.Collections.Generic; |
||
6 | |||
7 | namespace Markus.Service.DataBase.Test |
||
8 | { |
||
9 | f6c94121 | taeseongkim | public class DataBaseConvertDoc : TestBaseMSSQL |
10 | 731c84b8 | taeseongkim | { |
11 | public List<string> newConvertDocIDs = new List<string>(); |
||
12 | |||
13 | bede677a | GeunHo Song | /// <summary> |
14 | /// 완료 |
||
15 | /// </summary> |
||
16 | 731c84b8 | taeseongkim | [Test, Description("Craete Convert Doc MSSQL Test")] |
17 | bede677a | GeunHo Song | public void CreateConvertDocAsync() |
18 | 731c84b8 | taeseongkim | { |
19 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
20 | { |
||
21 | var newConvertDocID = repository.CreateAsync(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
||
22 | |||
23 | newConvertDocIDs.Add(newConvertDocID); |
||
24 | Console.WriteLine($"new id : {newConvertDocID}"); |
||
25 | c1946e9c | GeunHo Song | |
26 | 731c84b8 | taeseongkim | var newConvertDocID2 = repository.CreateAsync(ProjectNo, docUri, "A1111111").GetAwaiter().GetResult(); |
27 | |||
28 | newConvertDocIDs.Add(newConvertDocID2); |
||
29 | Console.WriteLine($"new id : {newConvertDocID2}"); |
||
30 | 9e974b65 | GeunHo Song | Assert.Pass(newConvertDocID2); |
31 | 731c84b8 | taeseongkim | } |
32 | |||
33 | bede677a | GeunHo Song | |
34 | 731c84b8 | taeseongkim | } |
35 | |||
36 | 52b947bb | taeseongkim | |
37 | bede677a | GeunHo Song | /// <summary> |
38 | /// 완료 |
||
39 | /// </summary> |
||
40 | [Test, Description("Craete Convert Doc MSSQL Test")] |
||
41 | public void CreateConvertDoc() |
||
42 | { |
||
43 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
44 | { |
||
45 | var newConvertDocID = repository.Create(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
||
46 | 9e974b65 | GeunHo Song | |
47 | bede677a | GeunHo Song | newConvertDocIDs.Add(newConvertDocID); |
48 | Console.WriteLine($"new id : {newConvertDocID}"); |
||
49 | |||
50 | var newConvertDocID2 = repository.Create(ProjectNo, docUri, "A1111111").GetAwaiter().GetResult(); |
||
51 | 9e974b65 | GeunHo Song | |
52 | bede677a | GeunHo Song | newConvertDocIDs.Add(newConvertDocID2); |
53 | Console.WriteLine($"new id : {newConvertDocID2}"); |
||
54 | 9e974b65 | GeunHo Song | Assert.Pass(newConvertDocID2); |
55 | bede677a | GeunHo Song | } |
56 | } |
||
57 | |||
58 | |||
59 | /// <summary> |
||
60 | /// 완료 |
||
61 | /// </summary> |
||
62 | 52b947bb | taeseongkim | [Test, Description("GetConvertDocSingle Test")] |
63 | 0fce3dac | taeseongkim | public void GetConvertDocSingle() |
64 | 731c84b8 | taeseongkim | { |
65 | bede677a | GeunHo Song | this.CreateConvertDoc(); |
66 | |||
67 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
68 | 731c84b8 | taeseongkim | { |
69 | foreach (var convertDocID in newConvertDocIDs) |
||
70 | { |
||
71 | var convertDoc = repository.GetConvertDocSingleAsync(ProjectNo, ConvertID: convertDocID).GetAwaiter().GetResult(); |
||
72 | 9e974b65 | GeunHo Song | Assert.Pass(convertDoc.ID); |
73 | 731c84b8 | taeseongkim | Console.WriteLine($"ID : {convertDoc.ID} PROJECT_NO:{convertDoc.PROJECT_NO} DOCUMENT_URL:{convertDoc.DOCUMENT_URL} DOCUMENT_ID:{convertDoc.DOCUMENT_ID} ConvertPath:{convertDoc.ConvertPath} "); |
74 | 0fce3dac | taeseongkim | break; |
75 | 731c84b8 | taeseongkim | } |
76 | } |
||
77 | } |
||
78 | 52b947bb | taeseongkim | |
79 | bede677a | GeunHo Song | /// <summary> |
80 | /// 완료 |
||
81 | /// </summary> |
||
82 | [Test, Description("Select waitOrError msSQL Test")] |
||
83 | public void SelectWaitOrError() |
||
84 | { |
||
85 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
86 | { |
||
87 | var items = repository.GetWaitorErrorAsync(2).GetAwaiter().GetResult(); |
||
88 | |||
89 | foreach (var item in items) |
||
90 | { |
||
91 | 9e974b65 | GeunHo Song | Assert.Pass(item.ID); |
92 | bede677a | GeunHo Song | } |
93 | } |
||
94 | } |
||
95 | |||
96 | |||
97 | /// <summary> |
||
98 | /// 완료. |
||
99 | /// </summary> |
||
100 | 52b947bb | taeseongkim | [Test, Description("Select Top 10 Convert Doc MS SQL Test")] |
101 | public void SelectTop10ConvertDoc() |
||
102 | { |
||
103 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
104 | { |
||
105 | string sql = @"SELECT TOP(10) ID, PROJECT_NO, DOCUMENT_URL, DOCUMENT_ID, CREATE_DATETIME, STATUS, TOTAL_PAGE, CURRENT_PAGE, EXCEPTION, END_DATETIME, START_DATETIME, SERVICE_ID," |
||
106 | + "RECONVERTER FROM CONVERTER_DOC where CREATE_DATETIME >= @CREATE_DATETIME order by CREATE_DATETIME"; |
||
107 | |||
108 | var parameter = new List<sqlParameter>(); |
||
109 | bede677a | GeunHo Song | |
110 | 52b947bb | taeseongkim | parameter.Add(new sqlParameter("@CREATE_DATETIME", DateTime.Now.AddDays(-10), System.Data.DbType.DateTime)); |
111 | |||
112 | var items = repository.GetAsync<Markus.Service.DataBase.Entities.ConvertDoc>(sql, parameter).GetAwaiter().GetResult(); |
||
113 | |||
114 | foreach (var item in items) |
||
115 | { |
||
116 | Assert.Pass(item.ID); |
||
117 | } |
||
118 | } |
||
119 | } |
||
120 | 0fce3dac | taeseongkim | |
121 | bede677a | GeunHo Song | |
122 | /// <summary> |
||
123 | /// 완료. |
||
124 | /// </summary> |
||
125 | [Test, Description("CONVERT_SELECT_CONVERTINGITEMS")] |
||
126 | public void CONVERT_SELECT_CONVERTINGITEMS() |
||
127 | 0fce3dac | taeseongkim | { |
128 | bede677a | GeunHo Song | int TakeCount = 5; |
129 | 0fce3dac | taeseongkim | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
130 | { |
||
131 | bede677a | GeunHo Song | var items = repository.GetConvertingItemAsync(TakeCount).GetAwaiter().GetResult(); |
132 | 0fce3dac | taeseongkim | |
133 | foreach (var item in items) |
||
134 | { |
||
135 | Assert.Pass(item.ID); |
||
136 | } |
||
137 | } |
||
138 | } |
||
139 | bede677a | GeunHo Song | |
140 | /// <summary> |
||
141 | /// 완료. |
||
142 | /// </summary> |
||
143 | [Test, Description("SetCleanUpItem PostgreSQL Test")] |
||
144 | public void SelectSetCleanUpItem() |
||
145 | { |
||
146 | this.CreateConvertDoc(); |
||
147 | |||
148 | foreach (var item in newConvertDocIDs) |
||
149 | { |
||
150 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
151 | { |
||
152 | var items = repository.SetCleanUpItemAsync(item, 1).GetAwaiter().GetResult(); |
||
153 | |||
154 | Assert.Pass(item); |
||
155 | } |
||
156 | } |
||
157 | } |
||
158 | |||
159 | |||
160 | /// <summary> |
||
161 | /// 완료. |
||
162 | /// </summary> |
||
163 | [Test, Description("UpdateStatusAsync")] |
||
164 | public void UpdateStatusAsync() |
||
165 | { |
||
166 | using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) |
||
167 | { |
||
168 | var newConvertDocID = repository.CreateAsync(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
||
169 | |||
170 | var convertDoc = repository.GetConvertDocSingleAsync(ProjectNo, ConvertID: newConvertDocID).GetAwaiter().GetResult(); |
||
171 | |||
172 | Console.WriteLine($"ID : {convertDoc.ID} PROJECT_NO:{convertDoc.PROJECT_NO} DOCUMENT_URL:{convertDoc.DOCUMENT_URL} DOCUMENT_ID:{convertDoc.DOCUMENT_ID} ConvertPath:{convertDoc.ConvertPath} "); |
||
173 | |||
174 | 9e974b65 | GeunHo Song | var status = repository.UpdateStatusAsync("", convertDoc.ID , convertDoc.STATUS, convertDoc.TOTAL_PAGE, convertDoc.CURRENT_PAGE, "").GetAwaiter().GetResult(); |
175 | bede677a | GeunHo Song | |
176 | 9e974b65 | GeunHo Song | Assert.That(status, Is.EqualTo(1)); |
177 | bede677a | GeunHo Song | |
178 | 9e974b65 | GeunHo Song | |
179 | bede677a | GeunHo Song | } |
180 | } |
||
181 | |||
182 | 731c84b8 | taeseongkim | } |
183 | } |