Skip to content

Commit d34d00d

Browse files
MrWin3erjskonst
andcommitted
Aleksandr Ermakov (#43)
* Initial app * Sample of 1st lab * Tests samples * Added actions file * Fixed run steps (#28) * Test actions on PR (#30) * Added tests and sample A|B tasks * Added class task example, added vscode conf * lab * Labs Co-authored-by: Eugeny Konstantinov <[email protected]>
1 parent cf45a6f commit d34d00d

File tree

15 files changed

+690
-1
lines changed

15 files changed

+690
-1
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: .NET Core
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Setup .NET Core
13+
uses: actions/setup-dotnet@v1
14+
with:
15+
dotnet-version: 3.0.100
16+
- name: Build with dotnet
17+
run: |
18+
cd CourseApp
19+
dotnet build --configuration Release
20+
- name: Run tests
21+
run: |
22+
cd CourseApp.Tests
23+
dotnet test

.gitignore

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Download this file using PowerShell v3 under Windows with the following comand:
2+
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
3+
# or wget:
4+
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
5+
6+
# User-specific files
7+
*.suo
8+
*.user
9+
*.sln.docstates
10+
11+
# Build results
12+
13+
[Dd]ebug/
14+
[Rr]elease/
15+
x64/
16+
build/
17+
[Bb]in/
18+
[Oo]bj/
19+
20+
# NuGet Packages
21+
*.nupkg
22+
# The packages folder can be ignored because of Package Restore
23+
**/packages/*
24+
# except build/, which is used as an MSBuild target.
25+
!**/packages/build/
26+
# Uncomment if necessary however generally it will be regenerated when needed
27+
#!**/packages/repositories.config
28+
29+
# MSTest test Results
30+
[Tt]est[Rr]esult*/
31+
[Bb]uild[Ll]og.*
32+
33+
*_i.c
34+
*_p.c
35+
*.ilk
36+
*.meta
37+
*.obj
38+
*.pch
39+
*.pdb
40+
*.pgc
41+
*.pgd
42+
*.rsp
43+
*.sbr
44+
*.tlb
45+
*.tli
46+
*.tlh
47+
*.tmp
48+
*.tmp_proj
49+
*.log
50+
*.vspscc
51+
*.vssscc
52+
.builds
53+
*.pidb
54+
*.log
55+
*.scc
56+
57+
# OS generated files #
58+
.DS_Store*
59+
Icon?
60+
61+
# Visual C++ cache files
62+
ipch/
63+
*.aps
64+
*.ncb
65+
*.opensdf
66+
*.sdf
67+
*.cachefile
68+
69+
# Visual Studio profiler
70+
*.psess
71+
*.vsp
72+
*.vspx
73+
74+
# Guidance Automation Toolkit
75+
*.gpState
76+
77+
# ReSharper is a .NET coding add-in
78+
_ReSharper*/
79+
*.[Rr]e[Ss]harper
80+
81+
# TeamCity is a build add-in
82+
_TeamCity*
83+
84+
# DotCover is a Code Coverage Tool
85+
*.dotCover
86+
87+
# NCrunch
88+
*.ncrunch*
89+
.*crunch*.local.xml
90+
91+
# Installshield output folder
92+
[Ee]xpress/
93+
94+
# DocProject is a documentation generator add-in
95+
DocProject/buildhelp/
96+
DocProject/Help/*.HxT
97+
DocProject/Help/*.HxC
98+
DocProject/Help/*.hhc
99+
DocProject/Help/*.hhk
100+
DocProject/Help/*.hhp
101+
DocProject/Help/Html2
102+
DocProject/Help/html
103+
104+
# Click-Once directory
105+
publish/
106+
107+
# Publish Web Output
108+
*.Publish.xml
109+
110+
# Windows Azure Build Output
111+
csx
112+
*.build.csdef
113+
114+
# Windows Store app package directory
115+
AppPackages/
116+
117+
# Others
118+
*.Cache
119+
ClientBin/
120+
# [Ss]tyle[Cc]op.*
121+
~$*
122+
*~
123+
*.dbmdl
124+
*.[Pp]ublish.xml
125+
*.pfx
126+
*.publishsettings
127+
modulesbin/
128+
tempbin/
129+
130+
# EPiServer Site file (VPP)
131+
AppData/
132+
133+
# RIA/Silverlight projects
134+
Generated_Code/
135+
136+
# Backup & report files from converting an old project file to a newer
137+
# Visual Studio version. Backup files are not needed, because we have git ;-)
138+
_UpgradeReport_Files/
139+
Backup*/
140+
UpgradeLog*.XML
141+
UpgradeLog*.htm
142+
143+
# vim
144+
*.txt~
145+
*.swp
146+
*.swo
147+
148+
# svn
149+
.svn
150+
151+
# Remainings from resolvings conflicts in Source Control
152+
*.orig
153+
154+
# SQL Server files
155+
**/App_Data/*.mdf
156+
**/App_Data/*.ldf
157+
**/App_Data/*.sdf
158+
159+
160+
#LightSwitch generated files
161+
GeneratedArtifacts/
162+
_Pvt_Extensions/
163+
ModelManifest.xml
164+
165+
# =========================
166+
# Windows detritus
167+
# =========================
168+
169+
# Windows image file caches
170+
Thumbs.db
171+
ehthumbs.db
172+
173+
# Folder config file
174+
Desktop.ini
175+
176+
# Recycle Bin used on file shares
177+
$RECYCLE.BIN/
178+
179+
# Mac desktop service store files
180+
.DS_Store
181+
182+
# SASS Compiler cache
183+
.sass-cache
184+
185+
# Visual Studio 2014 CTP
186+
**/*.sln.ide
187+
188+
# Visual Studio temp something
189+
.vs/
190+
191+
# VS 2015+
192+
*.vc.vc.opendb
193+
*.vc.db
194+
195+
# Rider
196+
.idea/
197+
198+
**/node_modules/*
199+
200+
# Added by Jskonst
201+
Properties/
202+
203+
#####
204+
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
205+
#####

CourseApp.Tests/AutoTest.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using System;
2+
using Xunit;
3+
4+
namespace CourseApp.Tests
5+
{
6+
public class AutoTest
7+
{
8+
[Fact]
9+
public void TestEmptyConstructor()
10+
{
11+
var item = new Auto();
12+
Assert.Equal(60, item.Speed);
13+
Assert.Equal("Untitled", item.Name);
14+
Assert.Equal(2000, item.Year);
15+
}
16+
17+
[Fact]
18+
public void TestSetSpeed()
19+
{
20+
var item = new Auto();
21+
item.Speed = 75;
22+
Assert.Equal(75, item.Speed);
23+
}
24+
25+
[Fact]
26+
public void TestIncorrectSetSpeed()
27+
{
28+
var item = new Auto();
29+
try
30+
{
31+
item.Speed = -1000;
32+
}
33+
catch (System.Exception)
34+
{
35+
Console.WriteLine("Speed should be more 0 and less than 300");
36+
Assert.True(true);
37+
}
38+
39+
Assert.Equal(60, item.Speed);
40+
}
41+
42+
[Fact]
43+
public void TestCorrectIncorrectSetSpeed()
44+
{
45+
var item = new Auto();
46+
item.Speed = 100;
47+
try
48+
{
49+
item.Speed = -10;
50+
}
51+
catch
52+
{
53+
Assert.Equal(100, item.Speed);
54+
}
55+
56+
Assert.Equal(100, item.Speed);
57+
}
58+
59+
[Fact]
60+
public void TestIncorrectSetName()
61+
{
62+
var item = new Auto();
63+
item.Name = string.Empty;
64+
Assert.Equal(string.Empty, item.Name);
65+
}
66+
67+
[Fact]
68+
public void TestCorrectSetName()
69+
{
70+
var item = new Auto();
71+
item.Name = "Mercedes Benz";
72+
Assert.Equal("Mercedes Benz", item.Name);
73+
}
74+
75+
[Fact]
76+
public void TestSetYear()
77+
{
78+
var item = new Auto();
79+
item.Year = 1972;
80+
Assert.Equal(1972, item.Year);
81+
}
82+
}
83+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
6+
<NoWarn>1573,1591,1701;1702;1705</NoWarn>
7+
<IsPackable>false</IsPackable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
12+
<PackageReference Include="xunit" Version="2.4.0" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
14+
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<ProjectReference Include="..\CourseApp\CourseApp.csproj" />
19+
</ItemGroup>
20+
21+
<PropertyGroup>
22+
<CodeAnalysisRuleSet>../_stylecop/stylecop.ruleset</CodeAnalysisRuleSet>
23+
<GenerateFullPaths>true</GenerateFullPaths>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<AdditionalFiles Include="../_stylecop/stylecop.json" />
28+
</ItemGroup>
29+
30+
</Project>

0 commit comments

Comments
 (0)