Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
UFTest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
datdiep
UFTest
Commits
64b8275b
Commit
64b8275b
authored
Jun 15, 2022
by
datdiep
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
15a3e888
Pipeline
#15868
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
9 deletions
+45
-9
ControllerTest.cs
TestProject1/ControllerTest.cs
+45
-9
No files found.
TestProject1/ControllerTest.cs
View file @
64b8275b
...
@@ -5,21 +5,17 @@ using System.Linq;
...
@@ -5,21 +5,17 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
UF.AssessmentProject.Controllers
;
using
UF.AssessmentProject.Controllers
;
using
UF.AssessmentProject.Helper
;
using
Xunit
;
using
Xunit
;
namespace
TestProject1
namespace
TestProject1
{
{
public
class
ControllerTest
public
class
ControllerTest
{
{
private
readonly
TransactionController
_controller
;
TransactionController
_controller
=
new
TransactionController
();
public
ControllerTest
(
TransactionController
controller
)
{
_controller
=
controller
;
}
[
Fact
]
[
Fact
]
public
void
add_transaction
()
public
void
Expired
()
{
{
var
rq
=
new
UF
.
AssessmentProject
.
Model
.
Transaction
.
RequestMessage
()
var
rq
=
new
UF
.
AssessmentProject
.
Model
.
Transaction
.
RequestMessage
()
{
{
...
@@ -47,9 +43,49 @@ namespace TestProject1
...
@@ -47,9 +43,49 @@ namespace TestProject1
}
}
}
}
};
};
var
createdResponse
=
_controller
.
SubmitTRansaction
(
rq
);
ActionResult
<
UF
.
AssessmentProject
.
Model
.
Transaction
.
ResponseMessage
>
rs
=
_controller
.
SubmitTRansaction
(
rq
);
Assert
.
IsType
<
CreatedAtActionResult
>(
createdResponse
);
var
actual
=
(
OkObjectResult
)
rs
.
Result
;
var
resultmessage
=
actual
.
Value
as
UF
.
AssessmentProject
.
Model
.
Transaction
.
ResponseMessage
;
Assert
.
Equal
(
"Expired!"
,
resultmessage
.
resultmessage
);
}
[
Fact
]
public
void
Access_denied
()
{
var
rq
=
new
UF
.
AssessmentProject
.
Model
.
Transaction
.
RequestMessage
()
{
partnerkey
=
"aaa"
,
partnerpassword
=
"FG-00001"
,
partnerrefno
=
"RkFLRVBBU1NXT1JEMTIzNA=="
,
totalamount
=
1000
,
items
=
new
List
<
UF
.
AssessmentProject
.
Model
.
Transaction
.
itemdetail
>()
{
new
UF
.
AssessmentProject
.
Model
.
Transaction
.
itemdetail
()
{
name
=
"i-00001"
,
partneritemref
=
"Pen"
,
qty
=
5
,
unitprice
=
2
},
new
UF
.
AssessmentProject
.
Model
.
Transaction
.
itemdetail
()
{
name
=
"i-00002"
,
partneritemref
=
"Ruler"
,
qty
=
1
,
unitprice
=
100
}
}
};
rq
.
timestamp
=
DateTime
.
Now
.
ToString
();
var
rawsign
=
DateTime
.
Parse
(
rq
.
timestamp
).
ToString
(
"yyyyMMddHHmmss"
)
+
rq
.
partnerkey
+
rq
.
partnerrefno
+
rq
.
totalamount
+
rq
.
partnerpassword
;
string
sig
=
CommonUtils
.
ComputeSha256Hash
((
CommonUtils
.
EncodeBase64
(
rawsign
)));
rq
.
sig
=
sig
;
ActionResult
<
UF
.
AssessmentProject
.
Model
.
Transaction
.
ResponseMessage
>
rs
=
_controller
.
SubmitTRansaction
(
rq
);
var
actual
=
(
OkObjectResult
)
rs
.
Result
;
var
resultmessage
=
actual
.
Value
as
UF
.
AssessmentProject
.
Model
.
Transaction
.
ResponseMessage
;
Assert
.
Equal
(
"Access Denied!"
,
resultmessage
.
resultmessage
);
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment