Add project files.
This commit is contained in:
parent
cb44fd97c2
commit
736c6e9646
20
BankTest/BankTest.csproj
Normal file
20
BankTest/BankTest.csproj
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Bankos\Bankos.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
25
BankTest/UnitTest1.cs
Normal file
25
BankTest/UnitTest1.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using Bankos;
|
||||||
|
|
||||||
|
namespace BankTest
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class UnitTest1
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void TestMethod1()
|
||||||
|
{
|
||||||
|
int kezdEgyenleg = 1000;
|
||||||
|
int csokkento = 300;
|
||||||
|
int elVart = 700;
|
||||||
|
|
||||||
|
BankAdat ba = new BankAdat("Kiss Péter",kezdEgyenleg);
|
||||||
|
ba.Kivet(csokkento);
|
||||||
|
|
||||||
|
int eredmeny = ba.getEgyenleg();
|
||||||
|
|
||||||
|
Assert.AreEqual(elVart, eredmeny);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
Bankos.sln
Normal file
31
Bankos.sln
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31624.102
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bankos", "Bankos\Bankos.csproj", "{E94D1802-4B32-454E-AFA9-9C25A463EC31}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankTest", "BankTest\BankTest.csproj", "{C0AFC618-65A6-4DFC-881D-DFB2EE952FFA}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{E94D1802-4B32-454E-AFA9-9C25A463EC31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E94D1802-4B32-454E-AFA9-9C25A463EC31}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E94D1802-4B32-454E-AFA9-9C25A463EC31}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E94D1802-4B32-454E-AFA9-9C25A463EC31}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C0AFC618-65A6-4DFC-881D-DFB2EE952FFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C0AFC618-65A6-4DFC-881D-DFB2EE952FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C0AFC618-65A6-4DFC-881D-DFB2EE952FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C0AFC618-65A6-4DFC-881D-DFB2EE952FFA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {3C1F8C85-4C95-4F1D-8C04-45E3CBEE5230}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
8
Bankos/Bankos.csproj
Normal file
8
Bankos/Bankos.csproj
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
42
Bankos/Program.cs
Normal file
42
Bankos/Program.cs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Bankos
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
BankAdat ba = new BankAdat("Kiss Péter", 1000);
|
||||||
|
ba.Kivet(500);
|
||||||
|
Console.WriteLine(ba.getEgyenleg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BankAdat {
|
||||||
|
private string nev;
|
||||||
|
private int egyenleg;
|
||||||
|
public BankAdat(string benev, int egyen) {
|
||||||
|
nev = benev;
|
||||||
|
egyenleg = egyen;
|
||||||
|
}
|
||||||
|
public int getEgyenleg() {
|
||||||
|
return egyenleg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Kivet(int osszeg)
|
||||||
|
{
|
||||||
|
if (osszeg > egyenleg)
|
||||||
|
{
|
||||||
|
throw new ArgumentOutOfRangeException("osszeg");
|
||||||
|
}
|
||||||
|
if (osszeg < 0) {
|
||||||
|
throw new ArgumentOutOfRangeException("osszeg");
|
||||||
|
}
|
||||||
|
egyenleg -= osszeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user