Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ilya rpg #83

Open
wants to merge 50 commits into
base: Ilja_Raskatov
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
aeb27bc
Sample of 1st lab
Oct 10, 2019
0247220
Tests samples
Oct 17, 2019
096478a
Solve task A and B
Flamingo-37 Oct 22, 2019
34ee0b9
Solve
Flamingo-37 Oct 22, 2019
d514055
Added actions file
jskonst Oct 24, 2019
b29aa60
Fixed run steps (#28)
jskonst Oct 24, 2019
dbae387
Test actions on PR (#30)
jskonst Oct 24, 2019
953427e
Added tests and sample A|B tasks
jskonst Oct 24, 2019
62b5d9e
Added class task example, added vscode conf
Nov 7, 2019
aa0b4b1
Merge branch 'master' of https://github.com/ISUCT/Tprogramming_147_2019
Nov 7, 2019
8ed5f9c
lab 2.1
Flamingo-37 Nov 8, 2019
008ceb3
Lab 2.1
Flamingo-37 Nov 8, 2019
5017c9e
Lab 2.1
Flamingo-37 Nov 8, 2019
aca57bf
lab 2.2 Add Test
Flamingo-37 Nov 11, 2019
2bc3402
Update Program.cs
Flamingo-37 Nov 11, 2019
70c009d
Update Program.cs
Flamingo-37 Nov 11, 2019
1b6c674
Update Program.cs
Flamingo-37 Nov 11, 2019
7db2d03
Update Program.cs
Flamingo-37 Nov 11, 2019
2bed232
Update DemoTest.cs
Flamingo-37 Nov 11, 2019
0d9f210
Update DemoTest.cs
Flamingo-37 Nov 11, 2019
6892396
Update DemoTest.cs
Flamingo-37 Nov 11, 2019
0c9ccbb
Try add gitclone
Flamingo-37 Nov 11, 2019
61537fa
Merge branch 'Ilja_Raskatov' of https://github.com/Flamingo-37/Tprogr…
Flamingo-37 Nov 11, 2019
d703fa2
Update DemoTest.cs
Flamingo-37 Nov 12, 2019
ec5c050
Update CourseApp.Tests.csproj
Flamingo-37 Nov 12, 2019
202ec1f
Add Class Pig
Flamingo-37 Nov 12, 2019
561e745
Add Class Pig
Flamingo-37 Nov 12, 2019
3341088
Fix csproj
Flamingo-37 Nov 12, 2019
61f074a
Дополнения 1 и 2
Flamingo-37 Dec 5, 2019
ba56d21
Age
Flamingo-37 Dec 14, 2019
c687da5
Merge branch 'master' into Ilja_Raskatov
Flamingo-37 Dec 14, 2019
9fe6a87
Add SuperClass Without Tests
Flamingo-37 Dec 16, 2019
bd331ed
Add SuperClass without Tests
Flamingo-37 Dec 16, 2019
cf8512a
SuperClass
Flamingo-37 Dec 16, 2019
ebec247
Merge branch 'Ilja_Raskatov' of https://github.com/Flamingo-37/Tprogr…
Flamingo-37 Dec 16, 2019
7ef2eb8
SuperClass
Flamingo-37 Dec 16, 2019
6d0e7fe
SuperClass without Tests
Flamingo-37 Dec 16, 2019
881448f
I dont know what is happened with git (
Flamingo-37 Dec 16, 2019
c5a4041
Solve Problem
Flamingo-37 Dec 16, 2019
3d7ea9b
Add RPG
Flamingo-37 Jan 6, 2020
7811991
Merge branch 'Ilja_Raskatov' into Flamingo-37
Flamingo-37 Jan 6, 2020
8c3ce0d
Fix
Flamingo-37 Jan 9, 2020
c36ee06
Fix
Flamingo-37 Jan 9, 2020
d7a7033
fix2
Flamingo-37 Jan 9, 2020
9e7164d
fix3
Flamingo-37 Jan 9, 2020
fcc8e86
fix4.......
Flamingo-37 Jan 9, 2020
79b2e06
Fix5
Flamingo-37 Jan 9, 2020
8105d44
Fix RPG
Flamingo-37 Jan 9, 2020
46e97da
Fix RPG
Flamingo-37 Jan 9, 2020
6d71ef5
Fix RPG Test
Flamingo-37 Jan 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: .NET Core

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.802
- name: Build with dotnet
run: |
cd CourseApp
dotnet build --configuration Release
- name: Run tests
run: |
cd CourseApp.Tests
dotnet test
- name: Build with dotnet
run: |
cd RPG
dotnet build --configuration Release
- name: Run tests
run: |
cd RPG.Tests
dotnet test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ $RECYCLE.BIN/
**/node_modules/*

# Added by Jskonst
<<<<<<< HEAD
=======
.vscode/
>>>>>>> 1a30883c302a9f8e4ef3c380d6a061f88385a877
Properties/

#####
Expand Down
20 changes: 20 additions & 0 deletions CourseApp.Tests/AgeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Xunit;

namespace CourseApp.Tests
{
public class AgeTest
{
[Fact]
public void TodayBirthdayTest()
{
try
{
Assert.Equal(0, DateTime.Compare(DateTime.Now, AgeClass.CompareTheDate(DateTime.Now, DateTime.Now)));
}
catch (Exception)
{
}
}
}
}
61 changes: 31 additions & 30 deletions CourseApp.Tests/CourseApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<NoWarn>1573,1591,1701;1702;1705</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CourseApp\CourseApp.csproj" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>../_stylecop/stylecop.ruleset</CodeAnalysisRuleSet>
<GenerateFullPaths>true</GenerateFullPaths>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="../_stylecop/stylecop.json" />
</ItemGroup>

</Project>

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<NoWarn>1573,1591,1701;1702;1705</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CourseApp\CourseApp.csproj" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>../_stylecop/stylecop.ruleset</CodeAnalysisRuleSet>
<GenerateFullPaths>true</GenerateFullPaths>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="../_stylecop/stylecop.json" />
</ItemGroup>

</Project>
87 changes: 44 additions & 43 deletions CourseApp.Tests/DemoTest.cs
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
using System;
using System.Collections.Generic;
using Xunit;

namespace CourseApp.Tests
{
public class DemoTest
{
[Theory]
[InlineData(0.7, 5, 0.2196741002474553)]
[InlineData(2.2, 1.7, 0.4091366343551351)]
[InlineData(0.1, 4, 0.4617896586816621)]
public void TestFunction(double b, double x, double exp)
{
Assert.Equal(Program.Func(b, x), exp, 3);
}
[Fact]
public void ZeroFunction()
{
var res = Program.Func(0.0, 0.0);
Xunit.Assert.Equal(double.PositiveInfinity, res);
}

[Fact]
public void NullMassTest()
{
List<double> mass = new List<double>();
var res = Program.TaskB(2, mass);
Xunit.Assert.Equal(mass, res);
}

[Fact]
public void TestTaskB()
{
List<double> x = new List<double> { 1.1, 2.4, 3.6, 1.7, 3.9 };
var resultB = Program.TaskB(2.5, x);
var exp = new List<double> { 0.739333760444302, 0.599437811110944, 0.321394270206876, 0.725284786782826, 0.282846892996087 };
for (int i = 0; i < resultB.Count; i++)
{
Xunit.Assert.Equal(exp[i], resultB[i], 3);
}
}
}
using System;
using System.Collections.Generic;
using Xunit;

namespace CourseApp.Tests
{
public class DemoTest
{
[Theory]
[InlineData(0.7, 5, 0.2196741002474553)]
[InlineData(2.2, 1.7, 0.4091366343551351)]
[InlineData(0.1, 4, 0.4617896586816621)]
public void TestFunction(double b, double x, double exp)
{
Assert.Equal(Program.Func(b, x), exp, 3);
}

[Fact]
public void ZeroFunction()
{
var res = Program.Func(0.0, 0.0);
Assert.Equal(double.PositiveInfinity, res);
}

[Fact]
public void NullMassTest()
{
List<double> mass = new List<double>();
var res = Program.TaskB(2, mass);
Assert.Equal(mass, res);
}

[Fact]
public void TestTaskB()
{
List<double> x = new List<double> { 1.1, 2.4, 3.6, 1.7, 3.9 };
var resultB = Program.TaskB(2.5, x);
var exp = new List<double> { 0.739333760444302, 0.599437811110944, 0.321394270206876, 0.725284786782826, 0.282846892996087 };
for (int i = 0; i < resultB.Count; i++)
{
Assert.Equal(exp[i], resultB[i], 3);
}
}
}
}
71 changes: 71 additions & 0 deletions CourseApp.Tests/DogTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using Xunit;

namespace CourseApp.Tests
{
public class DogTest
{
[Fact]
public void TestEmptyConstructor()
{
var item = new Dog();
Assert.Equal(0, item.Age);
Assert.Equal("Test", item.Name);
Assert.Equal("male", item.Gender);
}

[Fact]
public void TestSetAge()
{
var item = new Dog();
item.Age = 5;
Assert.Equal(5, item.Age);
}

[Fact]
public void TestIncorrectSetAge()
{
var item = new Dog();
try
{
item.Age = -5;
}
catch (System.Exception)
{
Console.WriteLine("rewrite age.");
Assert.True(true);
}
}

[Fact]
public void TestIncorrectSetGender()
{
var item = new Dog();
try
{
item.Gender = "lemonade";
}
catch (System.Exception)
{
Console.WriteLine("rewrite gender");
Assert.True(true);
}
}

[Fact]
public void TestName()
{
var item = new Dog("Eevee");
Assert.Equal("Eevee", item.Name);
}

[Fact]
public void TestFullConstructor()
{
var item = new Dog("Mew", 5, "male");
Assert.Equal(5, item.Age);
Assert.Equal("Mew", item.Name);
Assert.Equal("male", item.Gender);
}
}
}
13 changes: 7 additions & 6 deletions CourseApp.Tests/PigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ public class PigTest
public void TestEmptyConstructor()
{
var item = new Pig();
Assert.Equal(1, item.Age);
Assert.Equal(0, item.Age);
Assert.Equal("Test", item.Name);
Assert.Equal(1, item.Salo);
Assert.Equal(0, item.Salo);
Assert.Equal("male", item.Gender);
}

[Theory]
[InlineData("PigMan", 5, 7,"male")]
[InlineData("PigGirl", 2, 1,"female")]
[InlineData("PigPigger", 10, 11,"male")]
[InlineData("PigMan", 5, 7, "male")]
[InlineData("PigGirl", 2, 1, "female")]
[InlineData("PigPigger", 10, 11, "male")]

public void TestFullConstructor(string name, int age, int salo, string gender)
{
var item = new Pig(name, age, salo, gender);
Expand Down Expand Up @@ -48,7 +49,7 @@ public void TestWrongSetAge()
{
Console.WriteLine("Возраст должен быть больше 1 года");
Assert.True(true);
}
}
}
}
}
25 changes: 25 additions & 0 deletions CourseApp/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.1/CourseApp.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions CourseApp/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/CourseApp.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/CourseApp.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/CourseApp.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
Loading