Add project files.

This commit is contained in:
Martin Murzsicz 2022-06-07 18:58:44 +02:00
parent 42c86cd8a8
commit a6a6d40011
5 changed files with 130 additions and 0 deletions

31
Bankos.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32413.511
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bankos", "Bankos\Bankos.csproj", "{3E80B462-491A-40C9-9E32-A651C92FBB6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankTest", "TestProject1\BankTest.csproj", "{2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3E80B462-491A-40C9-9E32-A651C92FBB6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E80B462-491A-40C9-9E32-A651C92FBB6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E80B462-491A-40C9-9E32-A651C92FBB6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E80B462-491A-40C9-9E32-A651C92FBB6C}.Release|Any CPU.Build.0 = Release|Any CPU
{2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B3B0F41-7C5E-44A4-9DD8-8EB8341301B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {057D358D-F849-4AE9-813B-5101D7A80DF8}
EndGlobalSection
EndGlobal

8
Bankos/Bankos.csproj Normal file
View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

49
Bankos/Program.cs Normal file
View File

@ -0,0 +1,49 @@
using System;
namespace Bankos
{
class Program
{
static void Main(string[] args)
{
BankAdat ba = new BankAdat("Kiss Péter", 1000);
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");
}
if (osszeg<=egyenleg && osszeg>0)
{
egyenleg -= osszeg;
}
}
}
}

View 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.9.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="coverlet.collector" Version="3.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bankos\Bankos.csproj" />
</ItemGroup>
</Project>

22
TestProject1/UnitTest1.cs Normal file
View File

@ -0,0 +1,22 @@
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);
}
}
}