Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
tsai
CAP
Commits
d143affa
Commit
d143affa
authored
Aug 21, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete, it not need to tests.
parent
a162d488
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
90 deletions
+0
-90
ObjectMethodExecutorTest.cs
test/DotNetCore.CAP.Test/ObjectMethodExecutorTest.cs
+0
-90
No files found.
test/DotNetCore.CAP.Test/ObjectMethodExecutorTest.cs
deleted
100644 → 0
View file @
a162d488
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Reflection
;
using
DotNetCore.CAP.Internal
;
using
Xunit
;
namespace
DotNetCore.CAP.Test
{
public
class
ObjectMethodExecutorTest
{
[
Fact
]
public
void
CanCreateInstance
()
{
var
testClass
=
new
MethodExecutorClass
();
var
methodInfo
=
testClass
.
GetType
().
GetMethod
(
"Foo"
);
var
executor
=
ObjectMethodExecutor
.
Create
(
methodInfo
,
typeof
(
MethodExecutorClass
).
GetTypeInfo
());
Assert
.
NotNull
(
executor
);
}
[
Fact
]
public
void
CanExcuteMethodWithNoParameters
()
{
var
testClass
=
new
MethodExecutorClass
();
var
methodInfo
=
testClass
.
GetType
().
GetMethod
(
"GetThree"
);
var
executor
=
ObjectMethodExecutor
.
Create
(
methodInfo
,
typeof
(
MethodExecutorClass
).
GetTypeInfo
());
Assert
.
NotNull
(
executor
);
var
objResult
=
executor
.
Execute
(
testClass
,
null
);
Assert
.
Equal
(
3
,
objResult
);
}
[
Fact
]
public
void
CanExcuteMethodWithParameters
()
{
var
testClass
=
new
MethodExecutorClass
();
var
methodInfo
=
testClass
.
GetType
().
GetMethod
(
"Add"
);
var
executor
=
ObjectMethodExecutor
.
Create
(
methodInfo
,
typeof
(
MethodExecutorClass
).
GetTypeInfo
());
Assert
.
NotNull
(
executor
);
var
objResult
=
executor
.
Execute
(
testClass
,
1
,
2
);
Assert
.
Equal
(
3
,
objResult
);
}
[
Fact
]
public
void
CanGetExcuteMethodDefaultValue
()
{
var
testClass
=
new
MethodExecutorClass
();
var
methodInfo
=
testClass
.
GetType
().
GetMethod
(
"WithDefaultValue"
);
var
executor
=
ObjectMethodExecutor
.
Create
(
methodInfo
,
typeof
(
MethodExecutorClass
).
GetTypeInfo
());
var
objResult
=
executor
.
GetDefaultValueForParameter
(
0
);
Assert
.
Equal
(
"aaa"
,
objResult
);
var
objResult2
=
executor
.
GetDefaultValueForParameter
(
1
);
Assert
.
Equal
(
"bbb"
,
objResult2
);
}
}
public
class
MethodExecutorClass
{
public
void
Foo
()
{
}
public
int
GetThree
()
{
return
3
;
}
public
int
Add
(
int
a
,
int
b
)
{
return
a
+
b
;
}
public
void
WithDefaultValue
(
string
aaa
=
"aaa"
,
string
bbb
=
"bbb"
)
{
}
}
}
\ No newline at end of file
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