Skip to content

Commit ca475fc

Browse files
committed
Add test project
1 parent 10dc815 commit ca475fc

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

Tests/Tests.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="1.3.2" />
12+
<PackageReference Include="MSTest.TestFramework" Version="1.3.2" />
13+
</ItemGroup>
14+
15+
</Project>

Tests/UnitTest1.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
using pipelines_dotnet_core.Controllers;
5+
6+
namespace dotnetcore_tests
7+
{
8+
[TestClass]
9+
public class UnitTest1
10+
{
11+
[TestMethod]
12+
public void About()
13+
{
14+
// Arrange
15+
HomeController controller = new HomeController();
16+
17+
// Act
18+
ViewResult result = controller.About() as ViewResult;
19+
20+
// Assert
21+
Assert.AreEqual("Your application description page.", result.ViewData["Message"]);
22+
}
23+
24+
[TestMethod]
25+
public void Contact()
26+
{
27+
// Arrange
28+
HomeController controller = new HomeController();
29+
30+
// Act
31+
ViewResult result = controller.Contact() as ViewResult;
32+
33+
// Assert
34+
Assert.AreEqual("Your contact pagess.", result.ViewData["Message"]);
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)