Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
adnan
EasyParking
Commits
cf40b515
Commit
cf40b515
authored
Jan 25, 2020
by
adnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change unit test using xUnitTest instead of MsUnitTest
parent
6b86086a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
25 deletions
+21
-25
SIX/SIX/SIX.Web.Test/IndexControlletTest.cs
SIX/SIX/SIX.Web.Test/IndexControlletTest.cs
+14
-13
SIX/SIX/SIX.Web.Test/SIX.Web.Test.csproj
SIX/SIX/SIX.Web.Test/SIX.Web.Test.csproj
+2
-7
SIX/SIX/SIX.sln
SIX/SIX/SIX.sln
+5
-5
No files found.
SIX/SIX/SIX.Web.Test/
Student
Controlle
r
Test.cs
→
SIX/SIX/SIX.Web.Test/
Index
Controlle
t
Test.cs
View file @
cf40b515
using
System.Collections.Generic
;
using
System
;
using
System.Collections.Generic
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Moq
;
using
SIX.ApplicationLayer.Student
;
using
SIX.Web.Controllers
;
using
Xunit
;
namespace
SIX.Web.Test
{
[
TestClass
]
public
class
StudentControllerTest
public
class
IndexControllerTest
{
[
TestMethod
]
public
void
Index_Student_Number_
Grather_Than
_Zero
()
[
Fact
]
public
void
Index_
Is_
Student_Number_
Is_Not
_Zero
()
{
// Arrange
var
mockService
=
new
Mock
<
IStudentService
>();
mockService
.
Setup
(
svc
=>
svc
.
GetAll
())
.
Returns
(
new
List
<
Core
.
Student
.
Student
>
...
...
@@ -26,11 +25,13 @@ namespace SIX.Web.Test
var
controller
=
new
StudentController
(
mockService
.
Object
);
// Act
var
result
=
controller
.
Index
()
as
ViewResult
;
// Assert
Assert
.
AreEqual
(
typeof
(
SIX
.
Web
.
Models
.
StudentPageViewModel
),
result
.
Model
);
Assert
.
AreNotEqual
(
0
,
(
result
.
Model
as
SIX
.
Web
.
Models
.
StudentPageViewModel
).
Students
.
Count
);
var
result
=
controller
.
Index
()
as
ViewResult
;
//Assert
var
viewResult
=
Assert
.
IsType
<
ViewResult
>(
result
);
var
model
=
Assert
.
IsAssignableFrom
<
SIX
.
Web
.
Models
.
StudentPageViewModel
>(
viewResult
.
ViewData
.
Model
);
Assert
.
Equal
(
3
,
model
.
Students
.
Count
);
}
}
}
SIX/SIX/SIX.Web.Test/SIX.Web.Test.csproj
View file @
cf40b515
...
...
@@ -8,10 +8,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="
MSTest.TestAdapter
" Version="
1
.4.0" />
<PackageReference Include="
MSTest.TestFramework
" Version="
1
.4.0" />
<PackageReference Include="
xunit
" Version="
2
.4.0" />
<PackageReference Include="
xunit.runner.visualstudio
" Version="
2
.4.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
</ItemGroup>
...
...
@@ -19,8 +18,4 @@
<ProjectReference Include="..\SIX.Core\SIX.Core.csproj" />
<ProjectReference Include="..\SIX.Web\SIX.Web.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" />
<Reference Include="Microsoft.AspNetCore.Mvc.ViewFeatures, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" />
</ItemGroup>
</Project>
SIX/SIX/SIX.sln
View file @
cf40b515
...
...
@@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SIX.Infrastructure", "SIX.I
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SIX.Web", "SIX.Web\SIX.Web.csproj", "{7DB6F399-DA1C-463E-ABEA-AC6F0897B428}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SIX.Web.Test", "SIX.Web.Test\SIX.Web.Test.csproj", "{
AEF7D299-9B77-4D86-9731-0B979B28DF1C
}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SIX.Web.Test", "SIX.Web.Test\SIX.Web.Test.csproj", "{
41C3CF35-DFD0-4C3F-B944-55E02B307535
}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
@@ -33,9 +33,9 @@ Global
{7DB6F399-DA1C-463E-ABEA-AC6F0897B428}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DB6F399-DA1C-463E-ABEA-AC6F0897B428}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DB6F399-DA1C-463E-ABEA-AC6F0897B428}.Release|Any CPU.Build.0 = Release|Any CPU
{
AEF7D299-9B77-4D86-9731-0B979B28DF1C
}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{
AEF7D299-9B77-4D86-9731-0B979B28DF1C
}.Debug|Any CPU.Build.0 = Debug|Any CPU
{
AEF7D299-9B77-4D86-9731-0B979B28DF1C
}.Release|Any CPU.ActiveCfg = Release|Any CPU
{
AEF7D299-9B77-4D86-9731-0B979B28DF1C
}.Release|Any CPU.Build.0 = Release|Any CPU
{
41C3CF35-DFD0-4C3F-B944-55E02B307535
}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{
41C3CF35-DFD0-4C3F-B944-55E02B307535
}.Debug|Any CPU.Build.0 = Debug|Any CPU
{
41C3CF35-DFD0-4C3F-B944-55E02B307535
}.Release|Any CPU.ActiveCfg = Release|Any CPU
{
41C3CF35-DFD0-4C3F-B944-55E02B307535
}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
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