프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ServiceBase / Markus.Service.DataBase.Test / DataBaseConvertDoc.cs @ bede677a

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